<%
'作者：山林客（ah_bill）
'博客：http://ruizhinet.blog.163.com
'网站：http://www.ruizhinet.cn
'本信息不会影响您网站的正常访问，请保留
if RZ_IN<>1 then
	response.write("非法请求")
	response.end
end If

'通用分页类
Class RZPage
Private RZ_PageSize,RZ_RS,RZ_SQL,RZ_CurrentPage,RZ_FirstPage,RZ_EndPage,RZ_TotalPage,RZ_TotalRecord,RZ_URL,RZ_Error,RZ_QueryString,RZ_Urlrewrite,RZ_QueryString_Nohtml,RZ_Css_PreNext,RZ_Css_NumPage,RZ_Css_CurrentPage,RZ_RZParam,RZ_Process,RZ_Langu,RZ_Keyword,RZ_BeforePageStr

'初始化
Private Sub Class_Initialize
	RZ_PageSize=20 
	RZ_FirstPage=1 
	RZ_EndPage=1
	RZ_CurrentPage=1
	RZ_Langu=S_LANG
	Set RZ_RZParam=S_RZPARAM
	If RZ_Langu="" Then RZ_Langu=0
	RZ_QueryString=Trim(Request.ServerVariables("Query_String"))
	If RZ_QueryString="" or InStr(RZ_QueryString,".html")=0 Then
		RZ_Urlrewrite=0 '不是伪静态
		If Request.QueryString("page")="" Then
			RZ_CurrentPage=1
		ElseIf not(isNumber(Request.QueryString("page"))) Then
			RZ_CurrentPage=1
		ElseIf CInt(Trim(Request.QueryString("page")))<1 Then
			RZ_CurrentPage=1
		Else
			RZ_CurrentPage=CInt(Trim(Request.QueryString("page")))
		End If
	End If
	RZ_Css_PreNext="nextprev"
	RZ_Css_NumPage="pagenum"
	RZ_Css_CurrentPage="currentpage"
End Sub

'从请求参数返回信息
Public Sub Generate
	If IsObject(RZ_RZParam) Then 
	RZ_QueryString=RZ_RZParam.QueryString
	End If 
	If RZ_QueryString<>"" and InStr(RZ_QueryString,".html")>0 Then
		RZ_Urlrewrite=1 '伪静态
		RZ_CurrentPage=RZ_RZParam.CurrentPage
		RZ_Process=RZ_RZParam.Process
		RZ_BeforePageStr=RZ_RZParam.BeforePageStr
		RZ_Keyword=RZ_RZParam.Keyword
	End If
End Sub

'销毁
Private Sub Class_Terminate 
	If IsObject(RZ_RS) Then 
		RZ_RS.Close
		Set RZ_RS=Nothing
	End If 
End Sub

'得到当前的URL
Private Function GetURL()
	Dim j,s_PageQString,s_ResultQueryString
	s_PageQString="page="
	If RZ_Urlrewrite=0 Then
		If RZ_QueryString="" Then
			s_ResultQueryString = "page="
		Else
			If InstrRev(RZ_QueryString,s_PageQString)=0 Then
				s_ResultQueryString=RZ_QueryString&"&page="
			Else
				j = InstrRev(RZ_QueryString,s_PageQString)-2
				If j=-1 Then
					s_ResultQueryString="page="
				Else
					RZ_QueryString=Left(RZ_QueryString,j)
					s_ResultQueryString=RZ_QueryString&"&page="
				End If
			End If
		End If
		GetURL="?"&s_ResultQueryString
	Else 
		If S_STATIC=1 And (RZ_Process=RZ_PRE_ARTICLE_LIST Or RZ_Process=RZ_PRE_PRODUCT_LIST Or RZ_Process=RZ_PRE_PHOTO_LIST Or RZ_Process=RZ_PRE_JOB_LIST Or RZ_Process=RZ_PRE_SPECIAL_LIST) Then 
			Dim static_path
			static_path=Replace(RZ_BeforePageStr,",","-")
			GetURL=GetPath(RZ_HTML_PATH&"/"&RZ_Process&RZ_Langu&"/"&static_path&"p")
		Else 
			GetURL="?"&RZ_Process&RZ_Langu&"-"&RZ_BeforePageStr&"p"
		End If 
	End If
End Function

'手工传入请求参数
Public Property Let QueryString(s_QueryString)
	RZ_QueryString=s_QueryString
End Property

'设置语言
Public Property Let Langu(i_Langu)
	If i_Langu="1" Or i_Langu="0" Then 
		RZ_Langu=CInt(i_Langu)
	Else 
		WriteError("Langu参数不正确")
	End If 
End Property

'设置每页记录条数
Public Property Let PageSize(i_PageSize)
	If isNumber(i_PageSize) Then
		If i_PageSize>0 Then 
		RZ_PageSize=CInt(i_PageSize)
		Else
		RZ_PageSize=20
		End If 
	Else
		WriteError("PageSize参数不正确")
	End If
End Property

'返回每页记录条数
Public Property Get PageSize
	PageSize=RZ_PageSize
End Property	

'返回分页后的记录集
Public Property Get GetRS()
	Set RZ_RS=Server.createobject("adodb.recordset")
	RZ_RS.PageSize=PageSize
	RZ_RS.Open RZ_SQL,conn,1,1
	If not(RZ_RS.eof and RZ_RS.BOF) Then
		If RZ_CurrentPage>RZ_RS.PageCount Then
			RZ_CurrentPage=RZ_RS.PageCount
		End If
		RZ_RS.AbsolutePage=RZ_CurrentPage
	End If
	Set GetRS=RZ_RS
End Property

'设置查询语句
Public Property Let SetSQL(s_SQL)
	RZ_SQL=s_SQL
End Property

'设置RZPARAM对象
Public Property Let SetRZParam(o_RZParam)
	If IsObject(o_RZParam) Then 
		Set RZ_RZParam=o_RZParam
	End If 
End Property

'设置上一页下一页样式
Public Property Let SetCss_PreNext(s_Css_PreNext)
	RZ_Css_PreNext=s_Css_PreNext
End Property

'设置数字页码样式
Public Property Let SetCss_NumPage(s_Css_CurrentPage)
	RZ_Css_NumPage=s_Css_CurrentPage
End Property

'设置当前页样式
Public Property Let SetCss_CurrentPage(s_Css_CurrentPage)
	RZ_Css_CurrentPage=s_Css_CurrentPage
End Property

'创建分页导航条
Public Sub ShowPage()
	Dim pagenumresult
	pagenumresult=GetPageNum()
	response.write(pagenumresult)
End Sub

'返回记录条数
Public Property Get GetRecordCount()
	GetRecordCount=RZ_RS.RecordCount
End Property 

'返回页数
Public Function GetPageNum()
	Dim str_tmp
	RZ_URL = GetURL()
	RZ_TotalRecord=RZ_RS.RecordCount
	If RZ_TotalRecord<=0 then
		RZ_TotalPage=1
	Else
		If RZ_TotalRecord mod PageSize =0 Then
			RZ_TotalPage = CLng(RZ_TotalRecord \ RZ_PageSize)
		Else
			RZ_TotalPage = CLng(RZ_TotalRecord \ RZ_PageSize )+1
		End If
	End If
	If RZ_CurrentPage>RZ_TotalPage Then
		RZ_CurrentPage=RZ_TotalPage
	End If
	Do While RZ_FirstPage+10<=RZ_CurrentPage 
		RZ_FirstPage=RZ_FirstPage+10 
	loop 
	RZ_EndPage=RZ_FirstPage+9
	If RZ_EndPage>RZ_TotalPage then RZ_EndPage=RZ_TotalPage 
	Dim theresult
	theresult="<ul>"
	theresult=theresult&ShowPrv10
	theresult=theresult&ShowPrv
	theresult=theresult&ShowNumBtn
	theresult=theresult&ShowNext
	theresult=theresult&ShowNext10
	theresult=theresult&"</ul>"
	GetPageNum=theresult
End Function 

'显示前一页
Private Function ShowPrv()
	Dim i_Prvpage,s_Prvpage,s_Temp
	s_Prvpage=getstr("lang_prevpage")
	If RZ_CurrentPage = 1 Then
		s_Temp = "<li class='"&RZ_Css_PreNext&"'><span>" & s_Prvpage & "</span></li>"
	Else
		i_Prvpage = RZ_CurrentPage-1
		If RZ_Urlrewrite=0 Then
			s_Temp = "<li class='"&RZ_Css_PreNext&"'><a href=""" & RZ_URL & CStr(i_Prvpage) & """>" & s_Prvpage & "</a></li>"
		Else
			If InStr(RZ_QueryString,".html--")>0 Then
				s_Temp = "<li class='"&RZ_Css_PreNext&"'><a href=""" & RZ_URL & CStr(i_Prvpage) & ".html--"&escape(RZ_Keyword)&""">" & s_Prvpage & "</a></li>"
			Else 
				s_Temp = "<li class='"&RZ_Css_PreNext&"'><a href=""" & RZ_URL & CStr(i_Prvpage) & ".html"">" & s_Prvpage & "</a></li>"
		End If 
		End If
	End If
	ShowPrv = s_Temp
End Function

'显示下一页
Private Function ShowNext()
	Dim i_Nextpage,s_Nextpage,s_Temp
	s_Nextpage=getstr("lang_nextpage")
	If RZ_CurrentPage >= RZ_TotalPage Then
		s_Temp = "<li class='"&RZ_Css_PreNext&"'><span>" & s_Nextpage & "</span></li>"
	Else
		i_Nextpage = RZ_CurrentPage+1
		If RZ_Urlrewrite=0 Then
			s_Temp = "<li class='"&RZ_Css_PreNext&"'><a href=""" & RZ_URL & CStr(i_Nextpage) & """>" & s_Nextpage & "</a></li>"
		Else
			If InStr(RZ_QueryString,".html--")>0 Then
				s_Temp = "<li class='"&RZ_Css_PreNext&"'><a href=""" & RZ_URL & CStr(i_Nextpage) & ".html--"&escape(RZ_Keyword)&""">" & s_Nextpage & "</a></li>"
			Else 
				s_Temp = "<li class='"&RZ_Css_PreNext&"'><a href=""" & RZ_URL & CStr(i_Nextpage) & ".html"">" & s_Nextpage & "</a></li>"
			End If 
		End If
	End If
	ShowNext = s_Temp
End Function

'显示下10页
Private Function ShowNext10()
	Dim s_Temp, i_NextPage
	If RZ_TotalPage>10 and RZ_EndPage+1 <= RZ_TotalPage Then
		i_Nextpage = RZ_EndPage+1
		If RZ_Urlrewrite=0 Then
		s_Temp = "<li class='"&RZ_Css_NumPage&"'><a href=""" & RZ_URL & CStr(i_NextPage) & """>&gt;&gt;</a></li>"
		Else
		If InStr(RZ_QueryString,".html--")>0 Then
			s_Temp = "<li class='"&RZ_Css_NumPage&"'><a href=""" & RZ_URL & CStr(i_NextPage) & ".html--"&escape(RZ_Keyword)&""">&gt;&gt;</a></li>"
		Else 
			s_Temp = "<li class='"&RZ_Css_NumPage&"'><a href=""" & RZ_URL & CStr(i_NextPage) & ".html"">&gt;&gt;</a></li>"
		End If 
		End If
	End If
	ShowNext10 = s_Temp
End Function

'显示上10页
Private Function ShowPrv10()
	Dim s_Temp, i_PrvPage
	If RZ_TotalPage>10 And RZ_CurrentPage>10 Then
		i_PrvPage = RZ_FirstPage-10
		If i_PrvPage<1 Then
		i_PrvPage=1
		End If
		If RZ_Urlrewrite=0 Then
			s_Temp = "<li class='"&RZ_Css_NumPage&"'><a href=""" & RZ_URL & CStr(i_PrvPage) & """>&lt;&lt;</a></li>"
		Else
			If InStr(RZ_QueryString,".html--")>0 Then
				s_Temp = "<li class='"&RZ_Css_NumPage&"'><a href=""" & RZ_URL & CStr(i_PrvPage) & ".html--"&escape(RZ_Keyword)&""">&lt;&lt;</a></li>"
			Else 
				s_Temp = "<li class='"&RZ_Css_NumPage&"'><a href=""" & RZ_URL & CStr(i_PrvPage) & ".html"">&lt;&lt;</a></li>"
			End If 
		End If
	End If
	ShowPrv10 = s_Temp
End Function

'显示数字页码
Private Function ShowNumBtn()
	Dim i,s_Temp
	For i=RZ_FirstPage To RZ_EndPage
		If i<>RZ_CurrentPage Then
			If RZ_Urlrewrite=0 Then
			s_Temp = s_Temp & "<li class='"&RZ_Css_NumPage&"'><a href=""" & RZ_URL & CStr(i) & """>" & i & "</a></li>"
			Else
			If InStr(RZ_QueryString,".html--")>0 Then
			s_Temp = s_Temp & "<li class='"&RZ_Css_NumPage&"'><a href=""" & RZ_URL & CStr(i) & ".html--"&escape(RZ_Keyword)&""">" & i & "</a></li>"
			Else 
			s_Temp = s_Temp & "<li class='"&RZ_Css_NumPage&"'><a href=""" & RZ_URL & CStr(i) & ".html"">" & i & "</a></li>"
			End If 
			End If
		Else
			s_Temp = s_Temp & "<li class='"&RZ_Css_CurrentPage&"'><span>" & i & "</span></li>"
		End If
	Next
	ShowNumBtn = s_Temp
End Function

'显示分页信息
Public Sub  ShowPageInfo()
	response.Write(GetPageInfo)
End Sub

'返回统计信息
Public Function GetPageInfo()
	GetPageInfo="&nbsp;"&getstr("lang_totalrecord")& RZ_TotalRecord & getstr("lang_records")&"&nbsp;&nbsp;" & RZ_PageSize & getstr("lang_pagesize")
End Function

End Class

'面包屑类
Class RZCrumb

Private RZ_Typeid, RZ_Specialid, RZ_Str,RZ_Langu,RZ_HeaderTitle,RZ_HeaderKeyword, RZ_Keyword, gen, result

'初始化
Private Sub Class_Initialize
	If IsObject(S_RZPARAM) Then 
		RZ_Typeid=S_RZPARAM.Typeid
		RZ_Specialid=S_RZPARAM.Specialid
		RZ_Langu=S_RZPARAM.Langu
	Else 
		RZ_Typeid=0
		RZ_Specialid=0
		RZ_Str=""
		RZ_Langu=S_LANG
		If RZ_Langu="" Then RZ_Langu=0
	End If 
	gen=0
End Sub

'设置当前分类ID
Public Property Let Typeid(i_Typeid)
	If Not isNumber(i_Typeid) Then
		WriteError("Typeid必须是数值")
	Else
		RZ_Typeid=CInt(i_Typeid)
	End If 
End Property

'设置当前专题ID
Public Property Let Specialid(i_Specialid)
	If Not isNumber(i_Specialid) Then
		WriteError("Typeid必须是数值")
	Else
		RZ_Specialid=CInt(i_Specialid)
	End If 
End Property

'设置补充字符串
Public Property Let Str(s_Str)
	RZ_Str=s_Str
End Property

'设置Keyword
Public Property Let Keyword(s_Str)
	RZ_Keyword=s_Str
End Property

'返回Title头部
Public Property Get HeaderTitle()
	If gen=0 Then Generate
	If RZ_Str<>"" Then 
		RZ_HeaderTitle=RZ_Str
	End If 
	If RZ_Keyword<>"" Then 
		RZ_HeaderTitle=RZ_HeaderTitle&","&RZ_Keyword
	End If 
	HeaderTitle=Replace(RZ_HeaderTitle,",,",",")
End Property

'返回Keywords头部
Public Property Get HeaderKeyword()
	If gen=0 Then Generate
	If RZ_Str<>"" Then 
		RZ_HeaderKeyword=RZ_Str&","&RZ_HeaderKeyword
	End If 
	If RZ_Keyword<>"" Then 
		RZ_HeaderKeyword=RZ_HeaderKeyword&","&RZ_Keyword
	End If 
	HeaderKeyword=Replace(RZ_HeaderKeyword,",,",",")
End Property

'设置语言
Public Property Let Langu(i_Langu)
	If i_Langu="1" Or i_Langu="0" Then 
		RZ_Langu=CInt(i_Langu)
	Else 
		WriteError("Langu参数不正确")
	End If 
End Property

'生成
Public Function Generate()
If RZ_Typeid>0 Then 
	Dim rs,sql,path,pathname_chn,pathname_eng,fenlei,url,type_pre, keyword_chn, keyword_eng,usestatic
	path=GetTypeProperty(RZ_Typeid,"path")
	pathname_chn=GetTypeProperty(RZ_Typeid,"pathname_chn")
	pathname_eng=GetTypeProperty(RZ_Typeid,"pathname_eng")
	keyword_chn=GetTypeProperty(RZ_Typeid,"keyword_chn")
	keyword_eng=GetTypeProperty(RZ_Typeid,"keyword_eng")
	fenlei=GetTypeProperty(RZ_Typeid,"fenlei")
	url=GetTypeProperty(RZ_Typeid,"url")
	If keyword_chn<>"" Then 
		keyword_chn=Replace(keyword_chn,"&nbsp;",",")
	End If 
	If keyword_eng<>"" Then 
		keyword_eng=Replace(keyword_eng,"&nbsp;",",")
	End If 
	Select Case fenlei
		Case 1:
			type_pre=RZ_PRE_ARTICLE_LIST  
			usestatic=1
		Case 2:
			type_pre=RZ_PRE_PRODUCT_LIST
			usestatic=1
		Case 3:
			type_pre=RZ_PRE_PHOTO_LIST
			usestatic=1
		Case 5:
			type_pre=RZ_PRE_GUESTBOOK_LIST
			usestatic=0
		Case 6:
			type_pre=RZ_PRE_TYPE_SHOW
			usestatic=1
		Case 7:
			type_pre=RZ_PRE_JOB_LIST
			usestatic=1
		Case 8:
			type_pre=RZ_PRE_FRIENDLINK_LIST
			usestatic=1
		Case Else
			type_pre=""
	End Select 

	Dim path_arr, ub_path,pathname_arr,ub_pathname,i,path_pro,static_path,surl
	path_arr=Split(CutPath(path),",")
	ub_path=UBound(path_arr)
	If RZ_Langu=0 Then
		pathname_arr=Split(Left(pathname_chn,Len(pathname_chn)-1),",")
		RZ_HeaderKeyword=pathname_chn&","&keyword_chn&",瑞志,山林客,"
	Else
		pathname_arr=Split(Left(pathname_eng,Len(pathname_eng)-1),",")
		RZ_HeaderKeyword=pathname_eng&","&keyword_eng&",Ruizhi,SandLinker,"
	End If 
	ub_pathname=UBound(pathname_arr)
	If ub_pathname<>ub_path Then
		WriteError("分类ID和名称不能建立对应关系，请到分类管理中刷新分类")
	End If 
	RZ_HeaderTitle=pathname_arr(ub_pathname)
	For i=0 To ub_path
		path_pro=path_pro&","&path_arr(i)
		If Left(path_pro,1)="," Then 
			path_pro=Mid(path_pro,2)
		End if
		If type_pre<>"" Then 
			static_path=Replace(path_pro,",","-")
			If S_STATIC=1 And usestatic=1 Then 
				surl=GetPath(RZ_HTML_PATH&"/"&type_pre&""&RZ_Langu&"/t"&static_path&".html")
			Else 
				surl=GetPath("?"&type_pre&RZ_Langu&"-t"&path_pro&".html")
			End If 
			result=result&"<li><a href='"&surl&"'><span>"&pathname_arr(i)&"</span></a></li>"
		Else
			result=result&"<li><a href='"&url&"' target='_blank'><span>"&pathname_arr(i)&"</span></a></li>"
		End If 
	Next
End If  

'有专题
If RZ_Specialid>0 Then 
	set rs=server.createobject("adodb.recordset")
	sql="select * from c_special where visible=1 and id="&RZ_Specialid
	rs.open sql,conn,1,1
	If not rs.eof Then
		Dim speurl,specialname,specialkeyword
		If RZ_Langu=0 Then
			specialname=rs("specialname")
			specialkeyword=rs("keyword_chn")
		Else
			specialname=rs("specialengname")
			specialkeyword=rs("keyword_eng")
		End If 
		If specialkeyword<>"" Then
			specialkeyword=Replace(specialkeyword,"&nbsp;",",")
		End If 
		RZ_HeaderTitle=RZ_HeaderTitle&specialname
		RZ_HeaderKeyword=RZ_HeaderKeyword&specialname&","&specialkeyword&","
		If S_STATIC=1 Then 
			speurl=GetPath("/html/"&RZ_PRE_SPECIAL_SHOW&RZ_Langu&"/s"&RZ_Specialid&".html")
		Else
			speurl=GetPath("?"&RZ_PRE_SPECIAL_SHOW&RZ_Langu&"-s"&RZ_Specialid&".html")
		End If 
		result=result&"<li><a href='"&speurl&"' target='_blank'><span>"&specialname&"</span></a></li>"		
	End If 
	rs.close
	Set rs=Nothing 
End If 

If RZ_Str<>"" Then 
	RZ_HeaderTitle=RZ_Str
	result=result&"<li>"&RZ_Str&"</li>"
End If 
gen=1
End Function

'输出结果
Public Sub Show()
	If gen=0 Then Generate
	response.write(result)
End Sub

'返回记过
Public Property Get GetResult()
	If gen=0 Then Generate
	GetResult=result
End Property
End Class

'返回子分类
Class RZSubType

Private RZ_Typeid, RZ_Currentid, RZ_TopTypeid, RZ_TypeClass, RZ_Langu, RZ_NotShow, result,gen
Private RZ_SameLevel,RZ_OriginalTemplate, RZ_Template, RZ_HomeTemplate,RZ_Depth
Private RZ_LevelArray,RZ_LevelResultArray,RZ_LoopArray,RZ_TemplateArray, RZ_SameLevelArray
Private RZ_AllRecord,RZ_RecordNumber
'初始化
Private Sub Class_Initialize
	RZ_Typeid=S_RZPARAM.Typeid
	RZ_Template=""
	RZ_TopTypeid=S_RZPARAM.TopTypeid
	RZ_Currentid=S_RZPARAM.Typeid
	If RZ_TopTypeid="" Then RZ_TopTypeid=0
	If RZ_Currentid="" Then RZ_Currentid=0
	RZ_TypeClass=0
	RZ_Langu=S_LANG
	RZ_SameLevel=0
	RZ_NotShow=0
	RZ_RecordNumber=0
	RZ_AllRecord=0
	ReDim RZ_LevelArray(10)
	ReDim RZ_LevelResultArray(10) 
	ReDim RZ_LoopArray(10)
	ReDim RZ_TemplateArray(10)
	ReDim RZ_SameLevelArray(10)
	If RZ_Langu="" Then RZ_Langu=0
	RZ_Depth=10
	gen=0
End Sub

'设置语言
Public Property Let Langu(i_Langu)
	If i_Langu="1" Or i_Langu="0" Then 
		RZ_Langu=CInt(i_Langu)
	Else
		WriteError("Langu参数不正确")
	End If 
End Property

'设置是否显示本类下所有记录
Public Property Let AllRecord(i_AllRecord)
	If i_AllRecord="1" Or i_AllRecord="0" Then 
		RZ_AllRecord=CInt(i_AllRecord)
	Else
		WriteError("AllRecord参数不正确")
	End If 
End Property

'如果没有子分类则不显示
Public Property Let NotShow(i_NotShow)
	If i_NotShow="1" Or i_NotShow="0" Then 
		RZ_NotShow=CInt(i_NotShow)
	Else
		WriteError("NotShow参数不正确")
	End If 
End Property

'设置主分类ID
Public Property Let Typeid(i_Typeid)
	If Not isNumber(i_Typeid) Then
		WriteError("Typeid必须是数值")
	Else
		RZ_Typeid=CInt(i_Typeid)
	End If 
End Property

'设置显示记录数量
Public Property Let RecordNumber(i_RecordNumber)
	If Not isNumber(i_RecordNumber) Then
		WriteError("RecordNumber必须是数值")
	Else
		RZ_RecordNumber=CInt(i_RecordNumber)
	End If 
End Property


'设置模板
Public Property Let Template(s_Template)
	RZ_Template=ReadTagFile(s_Template)
	RZ_OriginalTemplate=RZ_Template
End Property

'设置选中的分类
Public Property Let Currentid(i_Currentid)
	If isNumber(i_Currentid) Then
		RZ_Currentid=CInt(i_Currentid)
	Else
		WriteError("Currentid必须是数字")
	End If 
End Property

'设置选中的分类
Public Property Let Depth(i_Depth)
	If isNumber(i_Depth) Then
		If i_Depth>1 Then 
			RZ_Depth=CInt(i_Depth+1)
			ReDim RZ_LevelArray(i_Depth+1)
			ReDim RZ_LevelResultArray(i_Depth+1) 
			ReDim RZ_LoopArray(i_Depth+1)
			ReDim RZ_TemplateArray(i_Depth+1)
			ReDim RZ_SameLevelArray(i_Depth+1)
		End If 
	Else
		WriteError("Depth必须是数字")
	End If 
End Property

Public Property Let SameLevel(i_SameLevel)
	If i_SameLevel="1" Or i_SameLevel="0" Then 
		RZ_SameLevel=CInt(i_SameLevel)
	Else
		WriteError("SameLevel参数不正确")
	End If 
End Property 

'设置分类的类型：1-8，使用逗号,分隔
Public Property Let TypeClass(s_TypeClass)
	If isNumber(s_TypeClass) Or InStr(s_TypeClass,",")>0 Then
		Dim tmpstr,tmparray,i
		tmpstr=CStr(s_TypeClass)
		If InStr(tmpstr,",")>0 Then
			tmparray=Split(tmpstr,",")
			For i=0 To UBound(tmparray)
				If Not isNumber(tmparray(i)) Then
					WriteError("TypeClass必须是以数字或逗号分隔的数字")
					Exit For 
				End If
			Next
		End If 
		RZ_TypeClass=CStr(tmpstr)
	Else 
		WriteError("TypeClass必须是以数字或逗号分隔的数字")
	End If 
End Property

'输出结果
Public Sub Show()
	If gen=0 Then GetSubType(RZ_Typeid)
	response.write(result)
End Sub

'返回结果
Public Property Get GetResult()
	If gen=0 Then GetSubType(RZ_Typeid)
	GetResult=result
End Property

'返回子分类
Private Function GetSubType(mytypeid)
Dim rs,sql,path,name,engname,htmlpath,fenlei,url,type_pre
Dim foundarr,foundarr2,pattern
Dim hometemplate,homecurrenttemplate,homenormaltemplate, recordtemplate, rlist, listtype
Dim firsttemplate,oddtemplate,eventemplate,lasttemplate, currenttemplate, normaltemplate
	If mytypeid=0 Or mytypeid=RZ_Typeid Then
		pattern="(<!--\{)(home)(\}-->)([.\s\S]*?)(<!--\{\/)(home)(\}-->)"
		foundarr=ExecTemplateTag(RZ_Template,pattern)
		RZ_HomeTemplate=foundarr(1)
		If RZ_HomeTemplate<>"" Then 
			pattern="(<!--\{)(current)(\}-->)([.\s\S]*?)(<!--\{\/)(current)(\}-->)"
			foundarr2=ExecTemplateTag(RZ_HomeTemplate,pattern)
			homecurrenttemplate=foundarr2(1)
			homenormaltemplate=Replace(RZ_HomeTemplate,foundarr2(0),"")
			If RZ_Currentid=0 And homecurrenttemplate<>"" Then 
				hometemplate=homecurrenttemplate
			Else
				hometemplate=homenormaltemplate
			End If 
			If mytypeid=0 Then
				If S_STATIC=1 Then
					hometemplate=Replace(hometemplate,"${url}",GetPath("index"&RZ_Langu&".html"))
				Else 
					hometemplate=Replace(hometemplate,"${url}",GetPath("?default"&RZ_Langu&".html"))
				End If 
				hometemplate=Replace(hometemplate,"${url_nonstatic}",GetPath("index.asp?default"&RZ_Langu&".html"))
				hometemplate=Replace(hometemplate,"${name}",text("首页","Home"))
			Else 
				set rs=server.createobject("adodb.recordset")
				sql="select * from c_type where visible=1 and id="&mytypeid
				rs.open sql,conn,1,1
				If Not rs.eof And Not rs.bof Then 
				hometemplate=ReplaceMarks(rs,hometemplate,0,0)
				End If 
				rs.close 
				Set rs=Nothing 
			End if 
			RZ_Template=Replace(RZ_Template,foundarr(0),hometemplate)
		End If 
	End If 
	
	Dim RZ_Tmp
	pattern="(<!--\{)(level1)(\}-->)([.\s\S]*?)(<!--\{\/)(level1)(\}-->)"
	foundarr=ExecTemplateTag(RZ_Template,pattern)
	RZ_LevelArray(0)=foundarr(0)
	RZ_LevelResultArray(0)=foundarr(1)
	If RZ_SameLevel=0 Then 
		If RZ_LevelArray(0)="" Then Call WriteTagError("rztype标签必须有level1子标签，并检查是否有标签未关闭或位置错误",RZ_OriginalTemplate)
	End If 
	pattern="(<!--\{)(loop1)(\}-->)([.\s\S]*?)(<!--\{\/)(loop1)(\}-->)"
	foundarr=ExecTemplateTag(RZ_LevelArray(0),pattern)
	If foundarr(1)<>"" Then 
		RZ_LoopArray(0)=foundarr(0)
		RZ_Tmp=foundarr(1)
	End If 
	If RZ_SameLevel=0 Then 
		If RZ_LoopArray(0)="" Then 	Call WriteTagError("rztype--level1标签必须有loop1子标签，并检查是否有标签未关闭或位置错误",RZ_OriginalTemplate)
	End If 
	pattern="(<!--\{)(first1)(\}-->)([.\s\S]*?)(<!--\{\/)(first1)(\}-->)"
	foundarr=ExecTemplateTag(RZ_LoopArray(0),pattern)
	If foundarr(1)<>"" Then 
		firsttemplate=foundarr(1)
		RZ_Tmp=Replace(RZ_Tmp,foundarr(0),"")
	End If 
	pattern="(<!--\{)(odd1)(\}-->)([.\s\S]*?)(<!--\{\/)(odd1)(\}-->)"
	foundarr=ExecTemplateTag(RZ_LoopArray(0),pattern)
	If foundarr(1)<>"" Then 
		oddtemplate=foundarr(1)
		RZ_Tmp=Replace(RZ_Tmp,foundarr(0),"")
	End If
	pattern="(<!--\{)(even1)(\}-->)([.\s\S]*?)(<!--\{\/)(even1)(\}-->)"
	foundarr=ExecTemplateTag(RZ_LoopArray(0),pattern)
	If foundarr(1)<>"" Then 
		eventemplate=foundarr(1)
		RZ_Tmp=Replace(RZ_Tmp,foundarr(0),"")
	End If
	pattern="(<!--\{)(last1)(\}-->)([.\s\S]*?)(<!--\{\/)(last1)(\}-->)"
	foundarr=ExecTemplateTag(RZ_LoopArray(0),pattern)
	If foundarr(1)<>"" Then 
		lasttemplate=foundarr(1)
		RZ_Tmp=Replace(RZ_Tmp,foundarr(0),"")
	End If
	pattern="(<!--\{)(current1)(\}-->)([.\s\S]*?)(<!--\{\/)(current1)(\}-->)"
	foundarr=ExecTemplateTag(RZ_LoopArray(0),pattern)
	If foundarr(1)<>"" Then 
		currenttemplate=foundarr(1)
		RZ_Tmp=Replace(RZ_Tmp,foundarr(0),"")
	End If
	normaltemplate=RZ_Tmp
	set rs=server.createobject("adodb.recordset")
	If RZ_TypeClass>0 Then
		sql="select * from c_type where visible=1 and fenlei in("&RZ_TypeClass&") and  parentid="&mytypeid&" order by theorder"
	Else 
		sql="select * from c_type where visible=1 and  parentid="&mytypeid&" order by theorder"
	End If
	Dim i,last, template
	i=0
	rs.open sql,conn,1,1
	If Not rs.eof Then 
	last=rs.recordcount
	Do While not rs.eof And Not rs.bof 
		i=i+1
		If (rs("id")=RZ_Currentid Or rs("id")=RZ_TopTypeid) And currenttemplate<>"" Then 
			template=currenttemplate
		ElseIf i=1 And firsttemplate<>"" Then 
			template=firsttemplate
		ElseIf i=last And lasttemplate<>"" Then 
			template=lasttemplate
		ElseIf (i Mod 2)=0 And eventemplate<>"" Then 
			template=eventemplate
		ElseIf (i Mod 2)=1 And oddtemplate<>"" Then
			Rtemplate=oddtemplate
		Else 
			template=normaltemplate
		End If 
		If RZ_SameLevel=0 Then 
			pattern="(<!--\{)(level2)(\}-->)([.\s\S]*?)(<!--\{\/)(level2)(}-->)"
			foundarr=ExecTemplateTag(template,pattern)
			If foundarr(1)<>"" Then
				RZ_LevelArray(1)=foundarr(0)
				RZ_LevelResultArray(1)=foundarr(1)
				Call GetSubTypes(rs("id"),i,1)
				If foundarr(1)<>RZ_LevelResultArray(1) Then 
				template=Replace(template,RZ_LevelArray(1),RZ_LevelResultArray(1))
				Else
				template=Replace(template,RZ_LevelArray(1),"")
				End If 
			End If
			pattern="(<!--\{)(record1)(\}-->)([.\s\S]*?)(<!--\{\/)(record1)(\}-->)"
			foundarr=ExecTemplateTag(template,pattern)
			If foundarr(0)<>"" Then 
				recordtemplate=foundarr(0)
			End If
			If recordtemplate<>"" Then 
				Select Case rs("fenlei")
					Case 1:
						listtype="article"
					Case 2:
						listtype="product"
					Case 3:
						listtype="photo"
					Case 5:
						listtype="guestbook"
					Case 7:
						listtype="job"
					Case Else
						listtype=""
				End Select 
				If listtype<>"" Then 
					Set rlist=new RZList
					rlist.ListType=listtype
					If RZ_AllRecord=1 Then 
					rlist.TypePath=""&CutPath(rs("path"))&""
					Else 
					rlist.typeids=""&rs("id")&""
					End If 
					If RZ_RecordNumber>0 Then 
					rlist.RecordNumber=RZ_RecordNumber
					End If 
					rlist.Template=foundarr(1)
					template=Replace(template,recordtemplate,rlist.GetResult())
					Set rlist=Nothing 
				End If 
			End If 
		Else
			pattern="(<!--\{)(level2)(\}-->)([.\s\S]*?)(<!--\{\/)(level2)(}-->)"
			foundarr=ExecTemplateTag(RZ_Template,pattern)
			If foundarr(1)<>"" Then
				RZ_LevelArray(1)=foundarr(0)
				RZ_LevelResultArray(1)=foundarr(1)
				Call GetSubTypes(rs("id"),i,1)
			End If 
		End If 
		RZ_TemplateArray(0)=RZ_TemplateArray(0)&Trim(ReplaceMarks(rs,template,i,0))
	rs.movenext
	Loop
	Else
		If RZ_NotShow=1 Then 
			gen=1
			result=""
			Exit Function 
		End If 
	End If 
	rs.close
	Set rs=Nothing
	RZ_LevelResultArray(0)=Trim(Replace(RZ_LevelResultArray(0),RZ_LoopArray(0),RZ_TemplateArray(0)))
	RZ_SameLevelArray(0)=RZ_LevelResultArray(0)
	If RZ_SameLevel=0 Then 
		RZ_Template=Replace(RZ_Template,RZ_LevelArray(0),RZ_LevelResultArray(0))
	Else
	Dim k
		For k=0 To RZ_Depth
		RZ_Template=Replace(RZ_Template,RZ_LevelArray(k),RZ_SameLevelArray(k))
	Next 
	End If 
	result=RZ_Template
gen=1
End Function

Private Function GetSubTypes(mytypeid,pi,j)

If j>=RZ_Depth Then
Exit Function
End If 
Dim rs,sql,path,name,engname,htmlpath,fenlei,url,type_pre,theresult
Dim foundarr,foundarr2,pattern
Dim hometemplate,homecurrenttemplate,homenormaltemplate, recordtemplate,rlist,listtype
Dim firsttemplate,oddtemplate,eventemplate,lasttemplate, currenttemplate, normaltemplate, RZ_Tmp
	pattern="(<!--\{)(loop"&j+1&")(\}-->)([.\s\S]*?)(<!--\{\/)(loop"&j+1&")(\}-->)"
	foundarr=ExecTemplateTag(RZ_LevelArray(j),pattern)
	If foundarr(1)<>"" Then 
		RZ_LoopArray(j)=foundarr(0)
		RZ_Tmp=foundarr(1)
	End If 
	If RZ_SameLevel=0 Then 
	If RZ_LoopArray(0)="" Then 	Call WriteTagError("rztype--level"&j+1&"标签必须有loop"&j+1&"子标签，并检查是否有标签未关闭或位置错误",RZ_OriginalTemplate)
	End If 
	pattern="(<!--\{)(first"&j+1&")(\}-->)([.\s\S]*?)(<!--\{\/)(first"&j+1&")(\}-->)"
	foundarr=ExecTemplateTag(RZ_LoopArray(j),pattern)
	If foundarr(1)<>"" Then 
		firsttemplate=foundarr(1)
		RZ_Tmp=Replace(RZ_Tmp,foundarr(0),"")
	End If 
	pattern="(<!--\{)(odd"&j+1&")(\}-->)([.\s\S]*?)(<!--\{\/)(odd"&j+1&")(\}-->)"
	foundarr=ExecTemplateTag(RZ_LoopArray(j),pattern)
	If foundarr(1)<>"" Then 
		oddtemplate=foundarr(1)
		RZ_Tmp=Replace(RZ_Tmp,foundarr(0),"")
	End If
	pattern="(<!--\{)(even"&j+1&")(\}-->)([.\s\S]*?)(<!--\{\/)(even"&j+1&")(\}-->)"
	foundarr=ExecTemplateTag(RZ_LoopArray(j),pattern)
	If foundarr(1)<>"" Then 
		eventemplate=foundarr(1)
		RZ_Tmp=Replace(RZ_Tmp,foundarr(0),"")
	End If
	pattern="(<!--\{)(last"&j+1&")(\}-->)([.\s\S]*?)(<!--\{\/)(last"&j+1&")(\}-->)"
	foundarr=ExecTemplateTag(RZ_LoopArray(j),pattern)
	If foundarr(1)<>"" Then 
		lasttemplate=foundarr(1)
		RZ_Tmp=Replace(RZ_Tmp,foundarr(0),"")
	End If
	pattern="(<!--\{)(current"&j+1&")(\}-->)([.\s\S]*?)(<!--\{\/)(current"&j+1&")(\}-->)"
	foundarr=ExecTemplateTag(RZ_LoopArray(j),pattern)
	If foundarr(1)<>"" Then 
		currenttemplate=foundarr(1)
		RZ_Tmp=Replace(RZ_Tmp,foundarr(0),"")
	End If
	normaltemplate=RZ_Tmp
	set rs=server.createobject("adodb.recordset")
	If RZ_TypeClass>0 Then
		sql="select * from c_type where visible=1 and fenlei in("&RZ_TypeClass&") and  parentid="&mytypeid&" order by theorder"
	Else 
		sql="select * from c_type where visible=1 and  parentid="&mytypeid&" order by theorder"
	End If
	Dim i,last,template
	i=0
	rs.open sql,conn,1,1
	If Not rs.eof Then 
	last=rs.recordcount
	Do While not rs.eof And Not rs.bof 
		i=i+1
		If (rs("id")=RZ_Currentid Or rs("id")=RZ_TopTypeid) And currenttemplate<>"" Then 
			template=currenttemplate
		ElseIf i=1 And firsttemplate<>"" Then 
			template=firsttemplate
		ElseIf i=last And lasttemplate<>"" Then 
			template=lasttemplate
		ElseIf (i Mod 2)=0 And eventemplate<>"" Then 
			template=eventemplate
		ElseIf (i Mod 2)=1 And oddtemplate<>"" Then
			template=oddtemplate
		Else 
			template=normaltemplate
		End If 
		If RZ_SameLevel=0 Then 
			pattern="(<!--\{)(level"&j+2&")(\}-->)([.\s\S]*?)(<!--\{\/)(level"&j+2&")(}-->)"
			foundarr=ExecTemplateTag(template,pattern)
			If foundarr(1)<>"" Then
				RZ_LevelArray(j+1)=foundarr(0)
				RZ_LevelResultArray(j+1)=foundarr(1)
				Call GetSubTypes(rs("id"),i,j+1)
				If RZ_LevelResultArray(j+1)<>foundarr(1) Then 
				template=Replace(template,RZ_LevelArray(j+1),RZ_LevelResultArray(j+1))
				Else
				template=Replace(template,RZ_LevelArray(j+1),"")
				End If 
			End If 
			pattern="(<!--\{)(record"&j+1&")(\}-->)([.\s\S]*?)(<!--\{\/)(record"&j+1&")(\}-->)"
			foundarr=ExecTemplateTag(template,pattern)
			If foundarr(0)<>"" Then 
				recordtemplate=foundarr(0)
			End If
			If recordtemplate<>"" Then 
				Select Case rs("fenlei")
					Case 1:
						listtype="article"
					Case 2:
						listtype="product"
					Case 3:
						listtype="photo"
					Case 5:
						listtype="guestbook"
					Case 7:
						listtype="job"
					Case Else
						listtype=""
				End Select 
				If listtype<>"" Then 
					Set rlist=new RZList
					rlist.ListType=listtype
					If RZ_AllRecord=1 Then 
					rlist.TypePath=""&CutPath(rs("path"))&""
					Else 
					rlist.typeids=""&rs("id")&""
					End If 
					If RZ_RecordNumber>0 Then 
					rlist.RecordNumber=RZ_RecordNumber
					End If 
					rlist.Template=foundarr(1)
					template=Replace(template,recordtemplate,rlist.GetResult())
					Set rlist=Nothing 
				End If 
			End If 
		Else
			pattern="(<!--\{)(level"&j+2&")(\}-->)([.\s\S]*?)(<!--\{\/)(level"&j+2&")(}-->)"
			foundarr=ExecTemplateTag(RZ_Template,pattern)
			If foundarr(1)<>"" Then
				RZ_LevelArray(j+1)=foundarr(0)
				RZ_LevelResultArray(j+1)=foundarr(1)
				Call GetSubTypes(rs("id"),i,j+1)
			End If 
		End If 
		theresult=theresult&Trim(ReplaceMarks(rs,template,i,pi))
	rs.movenext
	Loop
	RZ_LevelResultArray(j)=Replace(RZ_LevelResultArray(j),RZ_LoopArray(j),theresult)
	RZ_LevelResultArray(j)=Replace(RZ_LevelResultArray(j),"${pi}",pi)
	RZ_LevelResultArray(j)=Replace(RZ_LevelResultArray(j),"${lv}",j)
	RZ_SameLevelArray(j)=RZ_SameLevelArray(j)&Trim(RZ_LevelResultArray(j))
	End If 
	rs.close
	Set rs=Nothing
End Function

Private Function ReplaceMarks(rs,RZ_Template_tmp,i,pi)
	Dim path,name,engname,fenlei,url,type_pre,htmlpath
	path=rs("path")
	name=rs("name")
	engname=rs("engname")
	fenlei=rs("fenlei")
	url=rs("url")
	Select Case fenlei
		Case 1:
			type_pre=RZ_PRE_ARTICLE_LIST
		Case 2:
			type_pre=RZ_PRE_PRODUCT_LIST
		Case 3:
			type_pre=RZ_PRE_PHOTO_LIST
		Case 5:
			type_pre=RZ_PRE_GUESTBOOK_LIST
		Case 6:
			type_pre=RZ_PRE_TYPE_SHOW
		Case 7:
			type_pre=RZ_PRE_JOB_LIST
		Case Else
			type_pre=""
	End Select 
	htmlpath=CutPath(path)
	Dim static_path
	Dim LinkURL,LinkURL_NonStatic
	If type_pre<>"" Then
		If S_STATIC=1 Then
		static_path=Replace(htmlpath,",","-")
		LinkURL=GetPath(RZ_HTML_PATH&"/"&type_pre&RZ_Langu&"/t"&static_path&".html")
		LinkURL_NonStatic=GetPath("index.asp?"&type_pre&RZ_Langu&"-t"&htmlpath&".html")
		Else
		LinkURL=GetPath("?"&type_pre&RZ_Langu&"-t"&htmlpath&".html")
		LinkURL_NonStatic=GetPath("index.asp?"&type_pre&RZ_Langu&"-t"&htmlpath&".html")
		End If 
	Else
		LinkURL=url
	End If
	If fenlei=5 Then 
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${url}",LinkURL_NonStatic)
	else
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${url}",LinkURL)
	End If 
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${url_nonstatic}",LinkURL_NonStatic)
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${id}",rs("id"))
	If Not IsNull(rs("typeimg")) And rs("typeimg")<>"" Then 
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${typeimg}",rs("typeimg"))
	Else
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${typeimg}","")
	End If 
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${i}",i)
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${pi}",pi)
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${path}",htmlpath)
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${lv}",(rs("thelevel")-1))
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${name}",text(name,engname))
	RZ_Template_tmp=Replace(RZ_Template_tmp,"${lastmod}",GoogleSiteMaptime(rs("modifytime"),"ymd"))
	ReplaceMarks=RZ_Template_tmp
End Function 

End Class

'请求参数分解类
Class RZParam

Private RZ_TypePath,RZ_BeforePageStr,RZ_ContentID, RZ_SpecialID, RZ_CurrentPage, RZ_Langu, RZ_Process, RZ_Keyword,RZ_Admin,RZ_Typeid,RZ_TopTypeid,RZ_QueryString,RZ_Modelname,RZ_Flag, gen

'初始化
Private Sub Class_Initialize
	RZ_TypePath=""
	RZ_BeforePageStr=""
	RZ_Admin=0
	RZ_ContentID=0
	RZ_SpecialID=0
	RZ_CurrentPage=1
	If isNumber(app("rz_defaultlanguage")) Then 
	RZ_Langu=app("rz_defaultlanguage")
	Else
	RZ_Langu=0
	End If 
	RZ_Process="def"
	RZ_Keyword=""
	RZ_Typeid=0
	RZ_TopTypeid=0
	RZ_QueryString=Request.ServerVariables("QUERY_STRING")
	gen=0
End Sub

'处理
Public Function Generate()
'arl0-t126,23s15c212p2--keyword  t路径，s专题ID，c内容ID，p页码
	Dim params,testparams
	testparams=true
	params=RZ_QueryString
	If params<>"" And RZ_Admin=0 Then 
		params=HTMLEncode(params)
		If InStr(params,".html")>0 Then '伪静态地址
			If params="default0.html" Or params="default1.html" Then
				RZ_Process="def"
				RZ_Langu=Mid(params,8,1)
				response.cookies("lang")=RZ_Langu
				Exit Function 
			End If 
			If InStr(params,".html--")>0 Then '有搜索关键字
				Dim kwpos
				kwpos=InstrRev(params,".html--")
				RZ_Keyword=Mid(params,kwpos+7)
				If RZ_Keyword<>"" Then 
					RZ_Keyword=unescape(RZ_Keyword)
				End If 
				params=Left(params,kwpos+4)
			End If 
			Dim pattern,regEx,Matches,Match,result,foundval
			pattern="("&RZ_PRE_ARTICLE_LIST&"|"&RZ_PRE_PRODUCT_LIST&"|"&RZ_PRE_PHOTO_LIST&"|"&RZ_PRE_TYPE_SHOW&"|"&RZ_PRE_ARTICLE_SHOW&"|"&RZ_PRE_PRODUCT_SHOW&"|"&RZ_PRE_PHOTO_SHOW&"|"&RZ_PRE_SPECIAL_SHOW&"|"&RZ_PRE_SPECIAL_LIST&"|"&RZ_PRE_GUESTBOOK_LIST&"|"&RZ_PRE_GUESTBOOK_SHOW&"|"&RZ_PRE_JOB_LIST&"|"&RZ_PRE_JOB_SHOW&"|"&RZ_PRE_FRIENDLINK_LIST&"|"&RZ_PRE_FRIENDLINK_SHOW&"|"&RZ_PRE_MODULE_SHOW&"|"&RZ_PRE_COMMENT_LIST&"|"&RZ_PRE_COMMENT_SHOW&"|"&RZ_PRE_MAP&")([0|1])(\-)([\,0-9tcsp]*?)(\.html)"
			Set regEx=new RegExp
			regEx.MultiLine = false
			regEx.Pattern=(pattern)
			regEx.IgnoreCase=false
			regEx.Global=True
			Set Matches=regEx.Execute(params)
			If err.number<>0 Then
				response.write "错误:" & err.description
				err.clear
				Exit Function
			End If
			If Matches.count >0 Then
				for each Match in Matches
					foundval=Match.value
					RZ_Process=regEx.Replace(foundval,"$1")
					RZ_Langu=regEx.Replace(foundval,"$2")
					response.Cookies("lang")=RZ_Langu
					Dim middleparams
					middleparams=regEx.Replace(foundval,"$4")
					Call Processing(middleparams)
				Next
			Else
				testparams=false
			End If
			set regEx=Nothing
			If testparams=False Then 
				WriteError("请求参数错误01")
			End If 
		Else '普通地址
			Dim q_lang, q_recordid, q_specialid, q_typeid, q_modelname, q_path, q_flag
			q_lang=HTMLEncode(request.querystring("lang"))
			q_recordid=HTMLEncode(request.querystring("recordid"))
			q_specialid=HTMLEncode(request.querystring("specialid"))
			q_typeid=HTMLEncode(request.querystring("typeid"))
			q_modelname=HTMLEncode(request.querystring("modelname"))
			q_path=HTMLEncode(request.querystring("path"))
			q_flag=HTMLEncode(request.querystring("flag"))
			If q_lang<>"" Then
				If isNumber(q_lang) Then 
					If q_lang=1 Then 
						RZ_Langu=1
						response.cookies("lang")=1
					Else
						RZ_Langu=0
						response.cookies("lang")=0
					End If 
				End If 
			End If 
			If q_recordid<>"" Then
				If isNumber(q_recordid) Then 
					RZ_ContentId=q_recordid
				End If 
			End If 			
			If q_specialid<>"" Then
				If isNumber(q_specialid) Then 
					RZ_SpecialId=q_specialid
				End If 
			End If
			If q_typeid<>"" Then
				If isNumber(q_typeid) Then 
					RZ_TypeId=q_typeid
				End If 
			End If
			If q_modelname<>"" Then
				RZ_Modelname=q_modelname
			End If
			If q_path<>"" Then 
				RZ_TypePath=q_path
			End If 
			If q_flag<>"" Then 
				If isWord(q_flag) Then 
					RZ_Flag=q_flag
				End If 
			End If 

		End If 
	End If 
	gen=1
End Function 

Private Function Processing(midparam)
	Dim params,testparams
	params=midparam
	testparams=True
	RZ_BeforePageStr=params
	Dim pattern,regEx,Matches,Match,result,foundval
	pattern="([tcsp])([\,0-9]+)"
	Set regEx=new RegExp
	regEx.MultiLine = false
	regEx.Pattern=(pattern)
	regEx.IgnoreCase=false
	regEx.Global=True
	Set Matches=regEx.Execute(params)
	If err.number<>0 Then
		response.write "错误:" & err.description
		err.clear
		Exit Function
	End If
	Dim pre,num
	If Matches.count >0 Then
		for each Match in Matches
			foundval=Match.value
			pre=regEx.Replace(foundval,"$1")
			num=regEx.Replace(foundval,"$2")
			Select Case pre
				Case "t":
					Call ProcessingPath(num)
				Case "c":
					If isNumber(num) Then 
						RZ_ContentID=CInt(num)
					End If 
				Case "s":
					If isNumber(num) Then
						RZ_SpecialID=CInt(num)
					End If 
				Case "p":
					If isNumber(num) Then
						RZ_CurrentPage=CInt(num)
						RZ_BeforePageStr=Replace(RZ_BeforePageStr,"p"&num,"")
					End If 
			End Select 
		Next
	Else
		testparams=false
	End If
	set regEx=Nothing
	If testparams=False Then 
		WriteError("请求参数错误02")
	End If 
End Function 

Private Function ProcessingPath(num)
	Dim path
	path=num
	If InStr(path,",")>0 Then 
		Dim patharr,i
		patharr=Split(path,",")
		For i=0 To UBound(patharr)
			If Not isNumber(patharr(i)) Then 
				WriteError("请求参数错误05")
			End If 
		Next 
		RZ_TopTypeid=CInt(patharr(0))
		RZ_Typeid=CInt(patharr(UBound(patharr)))
		RZ_TypePath=path
	Else
		If isNumber(path) Then
			RZ_TypePath=path
			RZ_Typeid=CInt(RZ_TypePath)
			RZ_TopTypeid=CInt(RZ_Typeid)
		Else
			WriteError("请求参数错误04")
		End If 
	End If 
End Function

'手工传输请求参数
Public Property Let QueryString(s_QueryString)
	RZ_QueryString=s_QueryString
	Generate()
End Property

'返回请求参数
Public Property Get QueryString()
	QueryString=RZ_QueryString
End Property

'手工传输请求参数
Public Property Let Admin(i_Admin)
	If i_Admin="1" Or i_Admin="0" Then 
		RZ_Admin=i_Admin
	End If 
End Property

'返回分类路径
Public Property Get TypePath()
	If gen=0 Then Generate()
	TypePath=RZ_TypePath
End Property

'返回分类ID
Public Property Get Typeid()
	If gen=0 Then Generate()
	Typeid=RZ_Typeid
End Property

'返回顶级分类，适合菜单栏
Public Property Get TopTypeid()
	If gen=0 Then Generate()
	TopTypeid=RZ_TopTypeid
End Property

'返回内容记录ID
Public Property Get ContentID()
	If gen=0 Then Generate()
	ContentID=RZ_ContentID
End Property

'返回专题ID
Public Property Get SpecialID()
	If gen=0 Then Generate()
	SpecialID=RZ_SpecialID
End Property

'返回当前分页
Public Property Get CurrentPage()
	If gen=0 Then Generate()
	CurrentPage=RZ_CurrentPage
End Property

'返回语言
Public Property Get Langu()
	If gen=0 Then Generate()
	Langu=RZ_Langu
End Property

'返回处理器标识
Public Property Get Process()
	If gen=0 Then Generate()
	Process=RZ_Process
End Property

'返回关键字
Public Property Get Keyword()
	If gen=0 Then Generate()
	Keyword=RZ_Keyword
End Property

'返回模块ID
Public Property Get Modelname()
	If gen=0 Then Generate()
	Modelname=RZ_Modelname
End Property

'返回页码前的部分
Public Property Get BeforePageStr()
	If gen=0 Then Generate()
	BeforePageStr=RZ_BeforePageStr
End Property 

Public Property Get Flag()
	If gen=0 Then Generate()
	Flag=RZ_Flag
End Property 

End Class

'列表处理类
Class RZList
Private RL_Template,RL_ReplyTemplate,RL_ReplyTemplate0, RL_RZPage, RL_RZParam, RL_ListType, RL_Keyword, RL_Content_Len, RL_Title_Len, RL_Typeids, RL_Number, RL_PageNum, RL_FirstStyle, RL_OddStyle, RL_EvenStyle, RL_TypePath, RL_Specialid, RL_Langu, RL_OrderStr, RL_RecordId,RL_IsSystem,RL_ShowReply, RL_FirstTemplate, RL_OddTemplate, RL_EvenTemplate, RL_LastTemplate, RL_NormalTemplate, RL_SetSpecial, RL_HaveContent, RL_LoopTemplate, RL_NotShow, RL_HavePhoto
Private RL_HtmlClear
Dim result,finalresult, gen 

'设置模板
Public Property Let Template(s_Template)
	RL_Template=ReadTagFile(s_Template)
	If RL_Template<>"" Then
		Dim tmp,pattern,foundarr,tmploop
		pattern="(<!--\{)(loop)(\}-->)([.\s\S]*?)(<!--\{\/)(loop)(\}-->)"
		foundarr=ExecTemplateTag(RL_Template,pattern)
		If foundarr(1)<>"" Then 
			RL_LoopTemplate=foundarr(0)
			tmploop=foundarr(1)
		Else
			Call WriteTagError("rzlist必须有loop标签",s_Template)
		End If 
		pattern="(<!--\{)(first)(\}-->)([.\s\S]*?)(<!--\{\/)(first)(\}-->)"
		foundarr=ExecTemplateTag(RL_LoopTemplate,pattern)
		If foundarr(1)<>"" Then 
			RL_FirstTemplate=foundarr(1)
			tmploop=Replace(tmploop,foundarr(0),"")
		End If 
		pattern="(<!--\{)(odd)(\}-->)([.\s\S]*?)(<!--\{\/)(odd)(\}-->)"
		foundarr=ExecTemplateTag(RL_LoopTemplate,pattern)
		If foundarr(1)<>"" Then 
			RL_OddTemplate=foundarr(1)
			tmploop=Replace(tmploop,foundarr(0),"")
		End If 
		pattern="(<!--\{)(even)(\}-->)([.\s\S]*?)(<!--\{\/)(even)(\}-->)"
		foundarr=ExecTemplateTag(RL_LoopTemplate,pattern)
		If foundarr(1)<>"" Then 
			RL_EvenTemplate=foundarr(1)
			tmploop=Replace(tmploop,foundarr(0),"")
		End If 
		pattern="(<!--\{)(last)(\}-->)([.\s\S]*?)(<!--\{\/)(last)(\}-->)"
		foundarr=ExecTemplateTag(RL_LoopTemplate,pattern)
		If foundarr(1)<>"" Then 
			RL_LastTemplate=foundarr(1)
			tmploop=Replace(tmploop,foundarr(0),"")
		End If 
		RL_NormalTemplate=tmploop
		If InStr(RL_Template,"${content}")>0 Then RL_HaveContent=1
	End If 
End Property

'设置回复模板
Public Property Let ReplyTemplate(s_ReplyTemplate)
	RL_ReplyTemplate=s_ReplyTemplate
	If RL_ReplyTemplate<>"" Then RL_ShowReply=1
End Property

'设置RZPage对象
Public Property Let ObjRZPage(o_Page)
	If IsObject(o_Page) Then 
		Set RL_RZPage=o_Page
	End If 
End Property

'设置RZParam对象
Public Property Let ObjRZParam(o_Param)
	If IsObject(o_Param) Then 
		Set RL_RZParam=o_Param
	End If 
End Property

'设置列表类型
Public Property Let ListType(s_ListType)
	If s_ListType="article" Or s_ListType="product" Or s_ListType="photo"  Or s_ListType="special"  Or s_ListType="guestbook"  Or s_ListType="recordcomment" Or s_ListType="job"  Then 
		RL_ListType=s_ListType
	Else
		WriteError("列表类型有误，必须为以下之一：article/product/photo/special/job/guestbook/recordcomment/friendlink")
	End If 
End Property

'设置查询关键字，搜索的时候使用
Public Property Let Keyword(s_Keyword)
	RL_Keyword=HTMLEncode(s_Keyword)
End Property

'设置路径
Public Property Let TypePath(s_TypePath)
	RL_TypePath=s_TypePath
End Property

'设置专题ID
Public Property Let Specialid(i_Specialid)
	If isNumber(i_Specialid) Then 
		RL_SetSpecial=1
		RL_Specialid=CInt(i_Specialid)
	End If 
End Property

'设置评论对应的记录ID
Public Property Let RecordId(i_RecordId)
	If isNumber(i_RecordId) Then 
		RL_RecordId=CInt(i_RecordId)
	End If 
End Property

'设置内容显示长度
Public Property Let ContentLength(i_ContentLength)
	if isNumber(i_ContentLength) Then
		RL_Content_Len=CInt(i_ContentLength)
	End If
End Property

'设置标题长度
Public Property Let TitleLength(i_TitleLength)
	if isNumber(i_TitleLength) Then
		RL_Title_Len=CInt(i_TitleLength)
	End If
End Property

'是否显示回复
Public Property Let ShowReply(i_ShowReply)
	if i_ShowReply="0" Or i_ShowReply="1" Then
		RL_ShowReply=i_ShowReply
	End If
End Property

'没有匹配记录时是否隐藏整个块
Public Property Let NotShow(i_NotShow)
	if i_NotShow="0" Or i_NotShow="1" Then
		RL_NotShow=i_NotShow
	End If
End Property


'只选取有图片的记录（对product）有效
Public Property Let HavePhoto(i_HavePhoto)
	if i_HavePhoto="0" Or i_HavePhoto="1" Then
		RL_HavePhoto=i_HavePhoto
	End If
End Property


'是否清除HTML
Public Property Let HtmlClear(i_HtmlClear)
	If i_HtmlClear="0" Or i_HtmlClear="1" Then 
		RL_HtmlClear=i_HtmlClear
	End If 
End Property 

'设置查询分类，分类id之间用逗号分隔
Public Property Let Typeids(s_Typeids)
	If s_Typeids<>"" Then
	Dim i,v
	For i=1 To Len(Trim(s_Typeids))
		v=Mid(s_Typeids,i,1)
		If Instr("0123456789,",v)<=0 Then
			WriteError("分类格式不合法，分类id之间用逗号分隔，例子：12,28")
		End If
	Next
	RL_Typeids=s_Typeids
	End If
End Property

'设置显示记录条数，0表示全部显示
Public Property Let RecordNumber(i_Number)
	if isNumber(i_Number) Then
		RL_Number=CInt(i_Number)
	End If
End Property

'是否系统列表（带页码）
Public Property Let IsSystem(i_System)
	If i_System="0" Or i_System="1" Then 
		RL_IsSystem=CInt(i_System)
	End If 
End Property 

'设置是否显示底部分页导航条，2为显示页码和统计信息，1为显示页码，0为不显示
Public Property Let ShowPageNum(i_PageNum)
	if isNumber(i_PageNum) Then
		RL_PageNum=CInt(i_PageNum)
	End If
End Property

'设置首条记录样式
Public Property Let FirstStyle(s_FirstStyle)
	RL_FirstStyle=s_FirstStyle
End Property

'设置奇数行样式
Public Property Let OddStyle(s_OddStyle)
	RL_OddStyle=s_OddStyle
End Property

'设置偶数行样式
Public Property Let EvenStyle(s_EvenStyle)
	RL_EvenStyle=s_EvenStyle
End Property

'设置语言
Public Property Let Langu(i_Langu)
	If i_Langu="0" Or i_Langu="1" Then 
		RL_Langu=CInt(i_Langu)
	Else
		WriteError("Langu参数不正确")
	End If
End Property

'排序规则
Public Property Let TheOrder(i_TheOrder)
	If isNumber(i_TheOrder) Then
		Select Case i_TheOrder
			Case 1:
				RL_OrderStr=" orders desc, modifytime desc"
			Case 2:
				RL_OrderStr=" orders desc, hits desc, id desc"
			Case 3:
				RL_OrderStr=" id desc"
			Case 4:
				RL_OrderStr=" id"
			Case 5:
				RL_OrderStr=" modifytime desc, id"
			Case 6:
				RL_OrderStr=" modifytime, id desc"
			Case 7:
				RL_OrderStr=" hits desc, id desc"
			Case 8:
				RL_OrderStr=" hits, id desc"
			Case Else:
				RL_OrderStr=" orders desc, id desc"
		End Select
	Else
		WriteError("TheOrder参数不正确")
	End If
End Property


'初始化
Private Sub Class_Initialize
	RL_Content_Len=0
	RL_Title_Len=0
	RL_Number=0
	RL_PageNum=0
	RL_Specialid=0
	RL_FirstStyle=""
	RL_Typeids=""
	RL_OddStyle=""
	RL_EvenStyle=""
	RL_FirstTemplate=""
	RL_OddTemplate=""
	RL_EvenTemplate=""
	RL_LastTemplate=""
	RL_Langu=S_LANG
	RL_RecordId=0
	RL_ShowReply=0
	RL_SetSpecial=0
	RL_HaveContent=0
	RL_HtmlClear=1
	Set RL_RZParam=S_RZPARAM
	RL_Recordid=S_RZPARAM.ContentId
	RL_Specialid=S_RZPARAM.SpecialID
	If RL_Langu="" Then RL_Langu=0
	RL_OrderStr="orders desc,id desc"
	gen=0
End Sub

'销毁
Private Sub Class_Terminate 
If IsObject(RL_RZPage) Then 
Set RL_RZPage=Nothing 
End If 
End Sub

'输出结果
Public Sub Show()
	If gen=0 Then Generate()
	response.write(finalresult)
End Sub

'获取结果
Public Property Get GetResult()
	If gen=0 Then Generate()
	GetResult=finalresult
End Property

'生成
Public Sub Generate()
		Dim pattern,foundarr
		If RL_ListType="guestbook" Or RL_ListType="recordcomment" Then 
		pattern="(<!--\{)(reply)(\}-->)([.\s\S]*?)(<!--\{\/)(reply)(\}-->)"
		foundarr=ExecTemplateTag(RL_Template,pattern)
		RL_ReplyTemplate0=foundarr(0)
			If RL_ReplyTemplate0<>"" Then 
				RL_ReplyTemplate=foundarr(1)
				RL_ShowReply=1
			End If 
		End If 
	Dim tablename,rs,sql,i,notshowflag
	notshowflag=0
	Dim fieldnames,keywordfield
	Dim pre,titlefield, titletag,titletag_nolink,photofield,phototag,phototag_nolink,phototag_src,modelfield
	Dim replytablename
	Select Case RL_ListType
		Case "article":
			tablename="c_article"
			keywordfield="title"
			titlefield="title"
			photofield=""
			pre=RZ_PRE_ARTICLE_SHOW
		Case "photo":
			tablename="c_photo"
			keywordfield="photoname"
			titlefield="photoname"
			photofield="photoimg"
			pre=RZ_PRE_PHOTO_SHOW
		Case "product":
			tablename="c_product"
			keywordfield="productname"
			titlefield="productname"
			photofield="productimg"
			pre=RZ_PRE_PRODUCT_SHOW
		Case "job":
			tablename="c_job"
			keywordfield="name"
			titlefield="name"
			photofield=""
			pre=RZ_PRE_JOB_SHOW
		Case "special":
			tablename="c_special"
			keywordfield="specialname"
		Case "guestbook":
			tablename="c_comment"
			If RL_ShowReply=1 Then 
				replytablename="c_reply"
			End If 
			pre=RZ_PRE_GUESTBOOK_SHOW
		Case "recordcomment"
			tablename="c_record_comment"
			If RL_ShowReply=1 Then 
				replytablename="c_record_reply"
			End If 
			pre=RZ_PRE_COMMENT_SHOW
	End Select
	Dim sql_top
	If RL_Number>0 Then
		sql_top=" top "&RL_Number
	End If
	If RL_ListType="article" Or RL_ListType="photo" Or RL_ListType="product" Or RL_ListType="job"  Then 
		sql="select "&sql_top&" * from "&tablename&" where visible=1 and lang="&RL_Langu&" "
	ElseIf RL_ListType="guestbook" Or RL_ListType="recordcomment"  Then 
		sql="select "&sql_top&" * from "&tablename&" where lang="&RL_Langu&" "
	Else
		sql="select "&sql_top&" * from "&tablename&" where visible=1 "
	End If 
	If RL_ListType="product" And RL_HavePhoto=1 Then
	sql=sql&" and productimg<>'' "
	End If 
	If RL_ListType="article" Or RL_ListType="photo" Or RL_ListType="product" Or RL_ListType="guestbook"  Then
		If RL_ListType="article" Or RL_ListType="photo" Or RL_ListType="product" Then 
			If RL_SetSpecial=0 Then
				RL_Specialid=RL_RZParam.SpecialID
				If RL_Specialid>0 Then
					sql=sql&" and specialid="&RL_Specialid&" "
				End If 
			Else
				If RL_Specialid>0 Then
					sql=sql&" and specialid="&RL_Specialid&" "
				End If 
			End If 
		End If
		RL_Keyword=RL_RZParam.Keyword
		If RL_Keyword<>"" Then
			If InStr(RL_Keyword," ")>0 Then 
				Dim tmpkeywordarr,ki,tmpkw,tmpkwstr
				tmpkeywordarr=Split(RL_Keyword," ")
				For ki=0 To UBound(tmpkeywordarr)
					tmpkw=tmpkeywordarr(ki)
					If Len(tmpkw)>1 Then 
						tmpkwstr=tmpkwstr&" or "&keywordfield&" like '%"&tmpkw&"%'"
					End If 
				Next 
				If tmpkwstr<>"" Then 
					tmpkwstr=Mid(tmpkwstr,4)
					sql=sql&" and ("&tmpkwstr&")"
				End If 
			Else 
				sql=sql&" and ("&keywordfield&" like '%"&RL_Keyword&"%')"
			End If 
		End If 
		If RL_Typeids<>"" Then
			sql=sql&" and typeid in (" & RL_Typeids & ")"
		Else
			If RL_TypePath<>"" Then
				sql=sql&" and path like '%,"&RL_TypePath&",%' "
			Else
				RL_TypePath=RL_RZParam.TypePath
				If RL_TypePath<>"" Then
					sql=sql&" and path like '%,"&RL_TypePath&",%' "
				End If 
			End If 
		End If
	End If
	 
	If RL_ListType="recordcomment" Then 
		If RL_Typeids<>"" Then
			sql=sql&" and typeid in (" & RL_Typeids & ")"
		Else
			If RL_TypePath<>"" Then
				sql=sql&" and path like '%,"&RL_TypePath&",%' "
			Else
				RL_TypePath=RL_RZParam.TypePath
				If RL_TypePath<>"" Then
					sql=sql&" and path like '%,"&RL_TypePath&",%' "
				End If 
			End If 
		End If
		If  RL_RecordId>0 And RL_RZParam.Process<>RZ_PRE_COMMENT_SHOW Then
			sql=sql&" and recordid="&RL_RecordId&" "
		End If
	End If 
	
	If RL_ListType="guestbook" Or RL_ListType="recordcomment" Then
		sql=sql&" order by id desc"
	Else 
		sql=sql&" order by "&RL_OrderStr
	End If 
	Dim lastone
	lastone=0
	If IsObject(RL_RZPage) Then
		RL_RZPage.Generate()
		RL_RZPage.SetSQL=sql
		Set rs = RL_RZPage.GetRS()
		lastone=RL_RZPage.PageSize
		For i=1 To lastone
			If Not rs.EOF Then 
				If RL_ListType="special" Then 
					If i=1 And RL_FirstTemplate<>"" Then
						Call GenerateSpecialList(rs,i,RL_FirstTemplate)
					ElseIf i=lastone And RL_LastTemplate<>"" Then 
						Call GenerateSpecialList(rs,i,RL_LastTemplate)
					ElseIf (i mod 2)=1 And RL_OddTemplate<>"" Then
						Call GenerateSpecialList(rs,i,RL_OddTemplate)
					ElseIf (i mod 2)=0 And RL_EvenTemplate<>"" Then
						Call GenerateSpecialList(rs,i,RL_EvenTemplate)
					Else 
						Call GenerateSpecialList(rs,i,RL_NormalTemplate)
					End If 
				ElseIf RL_ListType="article" Or RL_ListType="photo" Or RL_ListType="product" Or RL_ListType="job" Then 
					If i=1 And RL_FirstTemplate<>"" Then
						Call GenerateList(rs,i,pre,titlefield,photofield,RL_FirstTemplate)
					ElseIf i=lastone And RL_LastTemplate<>"" Then 
						Call GenerateList(rs,i,pre,titlefield,photofield,RL_LastTemplate)
					ElseIf (i mod 2)=1 And RL_OddTemplate<>"" Then
						Call GenerateList(rs,i,pre,titlefield,photofield,RL_OddTemplate)
					ElseIf (i mod 2)=0 And RL_EvenTemplate<>"" Then
						Call GenerateList(rs,i,pre,titlefield,photofield,RL_EvenTemplate)
					Else 
						Call GenerateList(rs,i,pre,titlefield,photofield,RL_NormalTemplate)
						
					End If 
				ElseIf RL_ListType="guestbook" Or  RL_ListType="recordcomment" Then
					If i=1 And RL_FirstTemplate<>"" Then
						Call GenerateCommentList(rs,i,pre,replytablename,RL_FirstTemplate)
					ElseIf i=lastone And RL_LastTemplate<>"" Then 
						Call GenerateCommentList(rs,i,pre,replytablename,RL_LastTemplate)
					ElseIf (i mod 2)=1 And RL_OddTemplate<>"" Then
						Call GenerateCommentList(rs,i,pre,replytablename,RL_OddTemplate)
					ElseIf (i mod 2)=0 And RL_EvenTemplate<>"" Then
						Call GenerateCommentList(rs,i,pre,replytablename,RL_EvenTemplate)
					Else 
						Call GenerateCommentList(rs,i,pre,replytablename,RL_NormalTemplate)
					End If 
				End If  
			rs.Movenext
			Else
				Exit For
				notshowflag=1
			End If
		Next
		Dim pagestr
		If RL_PageNum=1 Or RL_PageNum=2 Then
			pagestr="<div id=""bottompage"">"
			pagestr=pagestr&RL_RZPage.GetPageNum()
			If RL_PageNum=2 Then 
				pagestr=pagestr&"<span class=""recordcount"">"
				pagestr=pagestr&RL_RZPage.GetPageInfo()
				pagestr=pagestr&"</span>"
			End If 
			pagestr=pagestr&"</div>"
		End If
			finalresult=Replace(RL_Template,RL_LoopTemplate,result)
			finalresult=Replace(finalresult,"${pagenum}",pagestr)
			finalresult=Replace(finalresult,"${recordcount}",lastone)
	Else
		set rs=server.createobject("adodb.recordset")
		rs.open sql,conn,1,1
		i=1
		If Not rs.eof Then
			lastone=rs.recordcount
			do while not rs.eof
				If RL_ListType="special" Then 
						If i=1 And RL_FirstTemplate<>"" Then
							Call GenerateSpecialList(rs,i,RL_FirstTemplate)
						ElseIf i=lastone And RL_LastTemplate<>"" Then 
							Call GenerateSpecialList(rs,i,RL_LastTemplate)
						ElseIf (i mod 2)=1 And RL_OddTemplate<>"" Then
							Call GenerateSpecialList(rs,i,RL_OddTemplate)
						ElseIf (i mod 2)=0 And RL_EvenTemplate<>"" Then
							Call GenerateSpecialList(rs,i,RL_EvenTemplate)
						Else 
							Call GenerateSpecialList(rs,i,RL_NormalTemplate)
						End If 
				ElseIf RL_ListType="article" Or RL_ListType="photo" Or RL_ListType="product" Or RL_ListType="job" Or RL_ListType="job" Then 
						If i=1 And RL_FirstTemplate<>"" Then
							Call GenerateList(rs,i,pre,titlefield,photofield,RL_FirstTemplate)
						ElseIf i=lastone And RL_LastTemplate<>"" Then 
							Call GenerateList(rs,i,pre,titlefield,photofield,RL_LastTemplate)
						ElseIf (i mod 2)=1 And RL_OddTemplate<>"" Then
							Call GenerateList(rs,i,pre,titlefield,photofield,RL_OddTemplate)
						ElseIf (i mod 2)=0 And RL_EvenTemplate<>"" Then
							Call GenerateList(rs,i,pre,titlefield,photofield,RL_EvenTemplate)
						Else 
							Call GenerateList(rs,i,pre,titlefield,photofield,RL_NormalTemplate)
						End If 
				ElseIf RL_ListType="guestbook" Or  RL_ListType="recordcomment"  Then 
						If i=1 And RL_FirstTemplate<>"" Then
							Call GenerateCommentList(rs,i,pre,replytablename,RL_FirstTemplate)
						ElseIf i=lastone And RL_LastTemplate<>"" Then 
							Call GenerateCommentList(rs,i,pre,replytablename,RL_LastTemplate)
						ElseIf (i mod 2)=1 And RL_OddTemplate<>"" Then
							Call GenerateCommentList(rs,i,pre,replytablename,RL_OddTemplate)
						ElseIf (i mod 2)=0 And RL_EvenTemplate<>"" Then
							Call GenerateCommentList(rs,i,pre,replytablename,RL_EvenTemplate)
						Else 
							Call GenerateCommentList(rs,i,pre,replytablename,RL_NormalTemplate)
						End If 
				End If 
				i=i+1
				rs.movenext
			Loop
		Else
		notshowflag=1
		End If 
		rs.close
		set rs=Nothing
		finalresult=Replace(RL_Template,RL_LoopTemplate,result)
	End If	
	If notshowflag=1 And RL_NotShow=1 Then finalresult=""
	gen=1
End Sub 

Private Function GenerateList(rs,pointer,pre,titlefield,photofield,targettemplate)
If targettemplate<>"" Then
	Dim LinkURL,The_Path, RL_Template_Content,static_path,short_path
	RL_Template_Content=targettemplate
	short_path=CutPath(rs("path"))
	static_path=Replace(short_path,",","-")
	If S_STATIC=1 Then 
		The_Path=GetPath(RZ_HTML_PATH&"/"&pre&RL_Langu&"/t"&static_path&"/c"&rs("id")&".html")
	Else 
		The_Path=GetPath("?"&pre&RL_Langu&"-t"&short_path&"c"&rs("id")&".html")
	End If
	If pre=RZ_PRE_ARTICLE_SHOW Or pre=RZ_PRE_PRODUCT_SHOW Or pre=RZ_PRE_PHOTO_SHOW Then
		If rs("specialid")>0 Then
			If S_STATIC=1 Then 
				The_Path=GetPath(RZ_HTML_PATH&"/"&pre&RL_Langu&"/t"&static_path&"/s"&rs("specialid")&"c"&rs("id")&".html")
			Else 
				The_Path=GetPath("?"&pre&RL_Langu&"-t"&short_path&"s"&rs("specialid")&"c"&rs("id")&".html")
			End If 
		End If 
		If rs("linkurl")<>"" Then 
			RL_Template_Content = Replace(RL_Template_Content, "${linkurl}",rs("linkurl"))
		Else 
			RL_Template_Content = Replace(RL_Template_Content, "${linkurl}","")
		End If 
	End If 
	Dim title
	title=Replace(rs(titlefield),"&nbsp;"," ")
	LinkURL="<a href="""&The_Path&""" title="""&title&""">"
	Dim theTitle,nolinkTitle
	If RL_Title_Len>0 Then
		theTitle=LinkURL&Left(title,RL_Title_Len)&"</a>"
		nolinkTitle=Left(title,RL_Title_Len)
	Else
		theTitle=LinkURL&title&"</a>"
		nolinkTitle=title
	End If
	RL_Template_Content = Replace(RL_Template_Content, "${"&titlefield&"}",theTitle)
	RL_Template_Content = Replace(RL_Template_Content, "${"&titlefield&"_nolink}",nolinkTitle)
	RL_Template_Content = Replace(RL_Template_Content, "${url}",The_Path)
	If photofield<>"" Then 
		RL_Template_Content = Replace(RL_Template_Content,"${"&photofield&"}",LinkURL&"<img src='"&rs(photofield)&"' alt='"&title&"'/></a>")
		RL_Template_Content = Replace(RL_Template_Content, "${"&photofield&"_nolink}","<img src='"&rs(photofield)&"' alt='"&title&"'/>")
		RL_Template_Content = Replace(RL_Template_Content, "${"&photofield&"_src}",rs(photofield))
	End If 
	If pre=RZ_PRE_PRODUCT_SHOW Then
		RL_Template_Content = Replace(RL_Template_Content, "${model}",rs("productid"))
	End If 
	If pre=RZ_PRE_JOB_SHOW Then
		RL_Template_Content = Replace(RL_Template_Content, "${place}",rs("place"))
		RL_Template_Content = Replace(RL_Template_Content, "${salary}",rs("salary"))
		RL_Template_Content = Replace(RL_Template_Content, "${number}",rs("number"))
		If Not IsNull(rs("endtime")) Then 
		RL_Template_Content = Replace(RL_Template_Content, "${endtime}",year(rs("endtime"))&"-"&month(rs("endtime"))&"-"&day(rs("endtime")))
		Else
		RL_Template_Content = Replace(RL_Template_Content, "${endtime}","")
		End If 
	End If 
	RL_Template_Content = Replace(RL_Template_Content, "${addtime}",year(rs("addtime"))&"-"&month(rs("addtime"))&"-"&day(rs("addtime")))
	RL_Template_Content = Replace(RL_Template_Content, "${year}",year(rs("addtime")))
	RL_Template_Content = Replace(RL_Template_Content, "${month}",month(rs("addtime")))
	RL_Template_Content = Replace(RL_Template_Content, "${day}",day(rs("addtime")))
	RL_Template_Content = Replace(RL_Template_Content, "${fulltime}",rs("addtime"))
	RL_Template_Content = Replace(RL_Template_Content,"${lastmod}",GoogleSiteMaptime(rs("modifytime"),"ymd"))
	RL_Template_Content = Replace(RL_Template_Content, "${path}",short_path)
	RL_Template_Content = Replace(RL_Template_Content, "${typeid}",rs("typeid"))
	RL_Template_Content = Replace(RL_Template_Content, "${specialid}",rs("specialid"))
	RL_Template_Content = Replace(RL_Template_Content, "${author}",rs("author"))
	RL_Template_Content = Replace(RL_Template_Content, "${hits}",rs("hits"))
	If RL_HaveContent=1 Then 
		If RL_Content_Len>0 Then
			If RL_Langu=0 Then 
			RL_Template_Content = Replace(RL_Template_Content, "${content}",left(ClearHTMLChn(rs("content")),RL_Content_Len))
			Else 
			RL_Template_Content = Replace(RL_Template_Content, "${content}",left(ClearHTML(rs("content")),RL_Content_Len))
			End If 
		Else 
			If RL_HtmlClear=1 Then 
			If RL_Langu=0 Then 
			RL_Template_Content = Replace(RL_Template_Content, "${content}",ClearHTMLChn(rs("content")))
			Else 
			RL_Template_Content = Replace(RL_Template_Content, "${content}",ClearHTML(rs("content")))
			End If 
			Else
			
			RL_Template_Content = Replace(RL_Template_Content, "${content}",rs("content"))
			End If 
		End If
	End If 
	RL_Template_Content = Replace(RL_Template_Content, "${id}",rs("id"))
	RL_Template_Content = Replace(RL_Template_Content, "${i}",pointer)
	result=result&RL_Template_Content
Else
WriteError("请设置列表模板")
End If 
End Function

'留言评论列表
Private Function GenerateCommentList(rs,pointer,pre,replytablename,targettemplate)
If targettemplate<>"" Then
	Dim LinkURL,The_Path, RL_Template_Content,static_path,short_path
	short_path=CutPath(rs("path"))
	static_path=Replace(short_path,",","-")
	The_Path=GetPath("index.asp?"&pre&RL_Langu&"-t"&short_path&"c"&rs("id")&".html")
	Dim title
	title=Replace(rs("title"),"&nbsp;"," ")
	LinkURL="<a href="""&The_Path&""" title="""&title&""">"
	RL_Template_Content=targettemplate
	Dim theTitle,nolinkTitle
	If RL_Title_Len>0 Then
		theTitle=LinkURL&Left(title,RL_Title_Len)&"</a>"
		nolinkTitle=Left(title,RL_Title_Len)
	Else
		theTitle=LinkURL&title&"</a>"
		nolinkTitle=title
	End If
	RL_Template_Content = Replace(RL_Template_Content, "${title}",theTitle)
	RL_Template_Content = Replace(RL_Template_Content, "${title_nolink}",nolinkTitle)
	RL_Template_Content = Replace(RL_Template_Content, "${url}",The_Path)
	RL_Template_Content = Replace(RL_Template_Content, "${addtime}",year(rs("addtime"))&"-"&month(rs("addtime"))&"-"&day(rs("addtime")))
	RL_Template_Content = Replace(RL_Template_Content, "${year}",year(rs("addtime")))
	RL_Template_Content = Replace(RL_Template_Content, "${month}",month(rs("addtime")))
	RL_Template_Content = Replace(RL_Template_Content, "${day}",day(rs("addtime")))
	RL_Template_Content = Replace(RL_Template_Content, "${fulltime}",rs("addtime"))
	RL_Template_Content = Replace(RL_Template_Content, "${path}",short_path)
	RL_Template_Content = Replace(RL_Template_Content, "${typeid}",rs("typeid"))
	RL_Template_Content = Replace(RL_Template_Content, "${author}",rs("author"))
	If ((pre=RZ_PRE_GUESTBOOK_SHOW And app("rz_guestbookaudit")=1) Or (pre=RZ_PRE_COMMENT_SHOW And app("rz_commentaudit")=1)) And rs("visible")=0  Then 
		RL_Template_Content = Replace(RL_Template_Content, "${content}",getstr("lang_gbawaiting"))
	Else 
		If RL_HaveContent=1 Then 
			If RL_Content_Len>0 Then
				RL_Template_Content = Replace(RL_Template_Content, "${content}",left(rs("content"),RL_Content_Len))
			Else
				If RL_HtmlClear=1 Then 
				If RL_Langu=0 Then 
				RL_Template_Content = Replace(RL_Template_Content, "${content}",ClearHTMLChn(rs("content")))
				Else 
				RL_Template_Content = Replace(RL_Template_Content, "${content}",ClearHTML(rs("content")))
				End If 
				Else
				RL_Template_Content = Replace(RL_Template_Content, "${content}",rs("content"))
				End If 
			End If
		End If 
	End If 
	RL_Template_Content = Replace(RL_Template_Content, "${email}",rs("email"))
	If pre=RZ_PRE_GUESTBOOK_SHOW Then 
	RL_Template_Content = Replace(RL_Template_Content, "${tel}",rs("tel"))
	RL_Template_Content = Replace(RL_Template_Content, "${company}",rs("company"))
	RL_Template_Content = Replace(RL_Template_Content, "${fax}",rs("fax"))
	End If 
	RL_Template_Content = Replace(RL_Template_Content, "${id}",rs("id"))
	RL_Template_Content = Replace(RL_Template_Content, "${hits}",rs("hits"))
	RL_Template_Content = Replace(RL_Template_Content, "${i}",pointer)
	Dim replytable
	If RL_ShowReply=1 Then 
		If RL_ReplyTemplate<>"" Then 
			Dim rs1,sql1,RL_ReplyTemplate_Content,result2
			Set rs1 = Server.CreateObject("ADODB.Recordset")
			sql1="select * from "&replytablename&" where commentid="&rs("id")
			rs1.open sql1,conn,1,1
			If Not rs1.eof Then 
				Do While Not rs1.eof 
				RL_ReplyTemplate_Content=RL_ReplyTemplate
				RL_ReplyTemplate_Content = Replace(RL_ReplyTemplate_Content, "${replycontent}",rs1("content"))
				RL_ReplyTemplate_Content = Replace(RL_ReplyTemplate_Content, "${replytime}",year(rs1("replytime"))&"-"&month(rs1("replytime"))&"-"&day(rs1("replytime")))
				RL_ReplyTemplate_Content = Replace(RL_ReplyTemplate_Content, "${fullreplytime}",rs1("replytime"))
				RL_ReplyTemplate_Content = Replace(RL_ReplyTemplate_Content, "${replyauthor}",rs1("replyauthor"))
				result2=result2&RL_ReplyTemplate_Content
				rs1.movenext
				Loop
				RL_Template_Content = Replace(RL_Template_Content, RL_ReplyTemplate0,result2)
			Else
				RL_Template_Content = Replace(RL_Template_Content, RL_ReplyTemplate0,"")
			End If 
			rs1.close
			Set rs1=Nothing
		End If 
	End If 
	result=result&RL_Template_Content
Else
WriteError("请设置列表模板")
End If 
End Function

'生成专题列表
Private Sub GenerateSpecialList(rs,pointer,targettemplate)
	If targettemplate<>"" Then
		Dim LinkURL,The_Path,RL_Template_Content,spe_name,spe_content,spe_iscontent
		spe_iscontent=0
		If S_STATIC=1 Then 
			The_Path=GetPath(RZ_HTML_PATH&"/"&RZ_PRE_SPECIAL_SHOW&RL_Langu&"/s"&rs("id")&".html")
		Else 
			The_Path=GetPath("?"&RZ_PRE_SPECIAL_SHOW&RL_Langu&"-s"&rs("id")&".html")
		End If 
		If RL_Langu=0 Then 
			spe_name=Replace(rs("specialname"),"&nbsp;"," ")
			If RL_HaveContent=1 Then 
				spe_content=rs("content_chn")
			End If 
		Else
			spe_name=Replace(rs("specialengname"),"&nbsp;"," ")
			If RL_HaveContent=1 Then 
				spe_content=rs("content_eng")
			End If 
		End If 
		LinkURL="<a href="""&The_Path&""" title="""&spe_name&""">"
		RL_Template_Content=targettemplate
		RL_Template_Content = Replace(RL_Template_Content, "${url}",The_Path) 
		Dim theSpeTitle, nolinkSpeTitle
		If RL_Title_Len>0 Then
			theSpeTitle=LinkURL&Left(spe_name,RL_Title_Len)&"</a>"
			nolinkSpeTitle=Left(spe_name,RL_Title_Len)
		Else
			theSpeTitle=LinkURL&spe_name&"</a>"
			nolinkSpeTitle=spe_name
		End If
		RL_Template_Content = Replace(RL_Template_Content, "${specialname}",theSpeTitle)
		RL_Template_Content = Replace(RL_Template_Content, "${specialname_nolink}",nolinkSpeTitle)
		If rs("specialimg")<>"" Then
			RL_Template_Content = Replace(RL_Template_Content, "${specialimg}",LinkURL&"<img src='"&rs("specialimg")&"' alt='"&spe_name&"'/></a>")
			RL_Template_Content = Replace(RL_Template_Content, "${specialimg_nolink}","<img src='"&rs("specialimg")&"' alt='"&spe_name&"'/>")
			RL_Template_Content = Replace(RL_Template_Content, "${specialimg_src}",rs("specialimg"))
		Else
			RL_Template_Content = Replace(RL_Template_Content, "${specialimg}","")
			RL_Template_Content = Replace(RL_Template_Content, "${specialimg_nolink}","")
			RL_Template_Content = Replace(RL_Template_Content, "${specialimg_src}","")
		End If
		If RL_HaveContent=1 Then
			If RL_Content_Len>0 Then
				If RL_Langu=0 Then 
				RL_Template_Content = Replace(RL_Template_Content, "${content}",left(clearhtmlchn(spe_content),RL_Content_Len))
				Else 
				RL_Template_Content = Replace(RL_Template_Content, "${content}",left(clearhtml(spe_content),RL_Content_Len))
				End If 
			Else
				If RL_HtmlClear=1 Then 
					If RL_Langu=0 Then 
					RL_Template_Content = Replace(RL_Template_Content, "${content}",ClearHTMLChn(spe_content))
					Else 
					RL_Template_Content = Replace(RL_Template_Content, "${content}",ClearHTML(spe_content))
					End If 
				Else
					RL_Template_Content = Replace(RL_Template_Content, "${content}",spe_content)
				End If 
			End If
		End If 
		RL_Template_Content = Replace(RL_Template_Content, "${id}",rs("id"))
		RL_Template_Content = Replace(RL_Template_Content, "${i}",pointer)
		result=result&RL_Template_Content
	Else
		WriteError("请设置专题列表模板")
	End If
End Sub

End Class 

'内容显示类
Class RZContent

Private RC_Template,RC_ReplyTemplate0,RC_ReplyTemplate, RC_Id, RC_ShowNext, RC_Langu, RC_RZParam,RC_Title,RC_Path,RC_URL,RC_Content_Len,RC_Title_Len,RC_HTMLClear,RC_ContentType,RC_Process,RC_Keyword, RC_ShowReply,RC_SetTitle, result, gen

'设置模板
Public Property Let Template(s_Template)
	RC_Template=ReadTagFile(s_Template)
End Property

'设置回复模板
Public Property Let ReplyTemplate(s_Template)
	RC_ReplyTemplate=ReadTagFile(s_Template)
End Property

'设置记录的ID
Public Property Let Id(i_Id)
	if isNumber(i_Id) Then
		RC_Id=CInt(i_Id)
	End If
End Property

'设置记录的Process
Public Property Let Process(s_Process)
	RC_Process=s_Process
End Property

'设置是否显示上一条、下一条，1为显示，0为不显示
Public Property Let ShowNext(i_ShowNext)
	If i_ShowNext="0" Or i_ShowNext="1" Then 
		RC_ShowNext=i_ShowNext
	End If 
End Property

'设置是否显示回复，1为显示，0为不显示
Public Property Let ShowReply(i_ShowReply)
	If i_ShowReply="0" Or i_ShowReply="1" Then 
		RC_ShowReply=i_ShowReply
	End If 
End Property

'设置语言
Public Property Let Langu(i_Langu)
	If i_Langu="0" Or i_Langu="1" Then 
		RC_Langu=CInt(i_Langu)
	End If
End Property

'是否设置为标题
Public Property Let SetTitle(i_SetTitle)
	If i_SetTitle="0" Or i_SetTitle="1" Then 
		RC_SetTitle=CInt(i_SetTitle)
	End If
End Property


'设置RZPARAM对象
Public Property Let ObjRZParam(o_Param)
	If IsObject(o_Param) Then 
		Set RC_RZParam=o_Param
	End If 
End Property

'设置内容显示长度
Public Property Let ContentLength(i_ContentLength)
	if isNumber(i_ContentLength) Then
		RC_Content_Len=CInt(i_ContentLength)
	End If
End Property

'设置内容类型
Public Property Let ContentType(s_ContentType)
	If s_ContentType="article" Or s_ContentType="product" Or s_ContentType="photo"  Or s_ContentType="special"  Or s_ContentType="guestbook"  Or s_ContentType="recordcomment" Or s_ContentType="job" Or s_ContentType="friendlink"  Then 
		RC_ContentType=s_ContentType
	Else
		WriteError("内容类型有误，必须为以下之一：article/product/photo/special/job/guestbook/recordcomment/friendlink")
	End If 
End Property

'设置标题长度，0表示全部显示
Public Property Let TitleLength(i_TitleLength)
	if isNumber(i_TitleLength) Then
		RC_Title_Len=CInt(i_TitleLength)
	End If
End Property

'是否清除内容的HTML标记
Public Property Let HTMLClear(i_HTMLClear)
	If i_HTMLClear="0" Or i_HTMLClear="1" Then 
		RC_HTMLClear=CInt(i_HTMLClear)
	Else
		WriteError("RC_ClearHTML参数不正确")
	End If
End Property

'初始化
Private Sub Class_Initialize
	RC_Id=0
	RC_ShowNext=0
	RC_Langu=S_LANG
	RC_Content_Len=0
	RC_Title_Len=0
	RC_HTMLClear=0
	RC_ShowReply=1
	if isobject(S_RZParam) Then
		RC_Process=S_RZPARAM.Process
		If RC_Process<>"" Then 
			RC_Id=S_RZPARAM.ContentId
			Select Case RC_Process
				Case RZ_PRE_ARTICLE_SHOW:
					RC_ContentType="article"
				Case RZ_PRE_PRODUCT_SHOW:
					RC_ContentType="product"
				Case RZ_PRE_PHOTO_SHOW:
					RC_ContentType="photo"
				Case RZ_PRE_JOB_SHOW:
					RC_ContentType="job"
				Case RZ_PRE_GUESTBOOK_SHOW:
					RC_ContentType="guestbook"
				Case RZ_PRE_COMMENT_SHOW:
					RC_ContentType="recordcomment"
			End Select 
		End If 
	End If 
	If RC_Langu="" Then RC_Langu=0
	gen=0
End Sub

'销毁
Private Sub Class_Terminate 
End Sub

'显示内容
Public Sub Show()
	If gen=0 Then Generate()
	response.write(result)
End Sub 

'返回内容
Public Property Get GetResult()
	If gen=0 Then Generate()
	GetResult=result
End Property 

'返回Keyword
Public Property Get Keyword()
	If gen=0 Then Generate()
	Keyword=RC_Keyword
End Property 

'返回标题
Public Property Get Title()
	If gen=0 Then Generate()
	Title=RC_Title
End Property 

'返回路径
Public Property Get Path()
	If gen=0 Then Generate()
	Path=RC_Path
End Property 

'返回对应超链接
Public Property Get URL()
	If gen=0 Then Generate()
	URL=RC_URL
End Property 

'生成
Public Sub Generate()
	Dim pattern,foundarr
	If RC_ContentType="guestbook" Or RC_ContentType="recordcomment" Then 
	pattern="(<!--\{)(reply)(\}-->)([.\s\S]*?)(<!--\{\/)(reply)(\}-->)"
	foundarr=ExecTemplateTag(RC_Template,pattern)
	RC_ReplyTemplate0=foundarr(0)
		If RC_ReplyTemplate0<>"" Then 
			RC_ReplyTemplate=foundarr(1)
			RC_ShowReply=1
		End If 
	End If 
	Dim sql,rs,sql2,rs2,sql3,rs3,tablename,rstest,sqltest,staticurl
	Dim titlefield, photofield,replytablename
	Select Case RC_ContentType
		case "article":
			tablename="c_article"
			titlefield="title"
			RC_Process=RZ_PRE_ARTICLE_SHOW
		case "product":
			tablename="c_product"
			titlefield="productname"
			photofield="productimg"
			RC_Process=RZ_PRE_PRODUCT_SHOW
		case "photo":
			tablename="c_photo"
			titlefield="photoname"
			photofield="photoimg"
			RC_Process=RZ_PRE_PHOTO_SHOW
		case "job":
			tablename="c_job"
			titlefield="name"
			RC_Process=RZ_PRE_JOB_SHOW
		Case "guestbook":
			tablename="c_comment"
			titlefield="title"
			replytablename="c_reply"
			RC_Process=RZ_PRE_GUESTBOOK_SHOW
		Case "recordcomment":
			tablename="c_record_comment"
			titlefield="title"
			replytablename="c_record_reply"
			RC_Process=RZ_PRE_COMMENT_SHOW
	End Select
	
	If RC_Process=RZ_PRE_GUESTBOOK_SHOW Or RC_Process=RZ_PRE_COMMENT_SHOW  Then 
		sql="select * from "&tablename&" where  id="&RC_Id
	Else 
		sql="select * from "&tablename&" where visible=1 and  id="&RC_Id
	End If 
	set rs=server.createobject("adodb.recordset")
	rs.open sql,conn,1,1
	If not (rs.eof or rs.bof) Then
			RC_Path=CutPath(rs("path"))
			staticurl=Replace(RC_Path,",","-")
			RC_Title=Replace(rs(titlefield),"&nbsp;"," ")
			If RC_ContentType="article" Or RC_ContentType="product" Or RC_ContentType="photo" Then 
				RC_Keyword=rs("keyword")
				If RC_Keyword<>"" Then
					RC_Keyword=Replace(RC_Keyword,"&nbsp;",",")
				End If 
			End If 
			If S_STATIC=1 Then 
				RC_URL=GetPath(RZ_HTML_PATH&"/"&RC_Process&RC_Langu&"/t"&staticurl&"/c"&rs("id")&".html")
			Else 
				RC_URL=GetPath("?"&RC_Process&RC_Langu&"-t"&RC_Path&"c"&rs("id")&".html")
			End If 
		If RC_Template<>"" Then 
			If RC_ShowNext=1 Then
				Dim previd,nextid,thisid,sqlprev,sqlnext,rsprev,rsnext
				previd=0
				nextid=0
				If RC_Process=RZ_PRE_GUESTBOOK_SHOW Or RC_Process=RZ_PRE_COMMENT_SHOW Then
				sqlprev="select id from "&tablename&" where lang="&rs("lang")&" order by id"
				Else 
				sqlprev="select id from "&tablename&" where visible=1 and lang="&rs("lang")&" order by id"
				End If 
				set rsprev=server.createobject("adodb.recordset")
				rsprev.open sqlprev,conn,1,1
				Do While (Not rsprev.eof And rsprev("id")<>rs("id"))
					previd=rsprev("id")
					If rsprev("id")=rs("id") Then
						Exit Do  
					End If 
				rsprev.movenext
				Loop 
				rsprev.close
				Set rsprev=Nothing 
				If RC_Process=RZ_PRE_GUESTBOOK_SHOW Or RC_Process=RZ_PRE_COMMENT_SHOW Then 
				sqlnext="select id from "&tablename&" where  lang="&rs("lang")&" order by id desc"
				else
				sqlnext="select id from "&tablename&" where visible=1 and lang="&rs("lang")&" order by id desc"
				End If 
				set rsnext=server.createobject("adodb.recordset")
				rsnext.open sqlnext,conn,1,1
				Do While (Not rsnext.eof And rsnext("id")<>rs("id"))
					nextid=rsnext("id")
					If rsnext("id")=rs("id") Then
						Exit Do  
					End If 
				rsnext.movenext
				Loop 
				rsnext.close
				Set rsnext=Nothing 
				sql2="select * from "&tablename&" where  id="&previd
				set rs2=server.createobject("adodb.recordset")
				rs2.open sql2,conn,1,1
				sql3="select * from "&tablename&" where  id="&nextid
				set rs3=server.createobject("adodb.recordset")
				rs3.open sql3,conn,1,1
			End If
			If RC_ContentType="article" Or RC_ContentType="product" Or RC_ContentType="photo"  Or RC_ContentType="job" Then 
				Call GenerateContent(RC_Process,rs,rs2,rs3,titlefield, photofield)
			ElseIf RC_ContentType="guestbook" Or RC_ContentType="recordcomment" Then 
				Call GenerateCommentContent(RC_Process,rs,rs2,rs3, replytablename)
			End If 
			If RC_ShowNext=1 Then
				rs2.close
				set rs2=nothing
				rs3.close
				set rs3=nothing
			End If
		End If
	End If	
	rs.close
	set rs=Nothing
	If RC_SetTitle=1 Then 
	If Not  IsObject(S_CRUMB) Then 
		S_CRUMB=new RZCrumb
	End If 
	S_CRUMB.Str=RC_Title
	End If 
	If IsObject(S_CRUMB) Then 
	S_CRUMB.Keyword=RC_Keyword
	End If 
	gen=1
End Sub

'生成内容
Private Function GenerateContent(pre,rs,rs2,rs3,titlefield, photofield)
	If RC_Template<>"" Then
		Dim RC_Template_Content
		RC_Template_Content=RC_Template
		Dim The_Path, static_path, short_path
		short_path=CutPath(rs("path"))
		static_path=Replace(short_path,",","-")
		If S_STATIC=1 Then 
			The_Path=GetPath(RZ_HTML_PATH&"/"&pre&RC_Langu&"/t"&static_path&"/c"&rs("id")&".html")
		Else 
			The_Path=GetPath("?"&pre&RC_Langu&"-t"&short_path&"c"&rs("id")&".html")
		End If
		If pre=RZ_PRE_ARTICLE_SHOW Or pre=RZ_PRE_PRODUCT_SHOW Or pre=RZ_PRE_PHOTO_SHOW Then 
			If rs("specialid")>0 Then
				If S_STATIC=1 Then 
					The_Path=GetPath(RZ_HTML_PATH&"/"&pre&RC_Langu&"/t"&static_path&"/s"&rs("specialid")&"c"&rs("id")&".html")
				Else 
					The_Path=GetPath("?"&pre&RC_Langu&"-t"&short_path&"s"&rs("specialid")&"c"&rs("id")&".html")
				End If 
			End If 
			If rs("linkurl")<>"" Then 
				RC_Template_Content = Replace(RC_Template_Content, "${linkurl}",rs("linkurl"))
			Else 
				RC_Template_Content = Replace(RC_Template_Content, "${linkurl}","")
			End If 
		End If 
		RC_Template_Content = Replace(RC_Template_Content, "${url}",The_Path) 
		RC_Template_Content = Replace(RC_Template_Content, "${path}",short_path) 
		RC_Template_Content = Replace(RC_Template_Content, "${typeid}",rs("typeid"))
		RC_Template_Content = Replace(RC_Template_Content, "${id}",rs("id"))
		If RC_Title_Len>0 Then 
			RC_Template_Content = Replace(RC_Template_Content, "${"&titlefield&"}",Left(Replace(rs(titlefield),"&nbsp;"," "),RC_Title_Len))
		Else 
			RC_Template_Content = Replace(RC_Template_Content, "${"&titlefield&"}" ,rs(titlefield))
		End If 
		If RC_Content_Len>0 Then 
			If RC_HTMLClear=1 Then
				If RC_Langu=0 Then 
				RC_Template_Content = Replace(RC_Template_Content, "${content}",Left(ClearHTMLChn(rs("content")),RC_Content_Len))
				Else 
				RC_Template_Content = Replace(RC_Template_Content, "${content}",Left(ClearHTML(rs("content")),RC_Content_Len))
				End If 
			Else 
				RC_Template_Content = Replace(RC_Template_Content, "${content}",Left(rs("content"),RC_Content_Len))
			End If 
		Else
			If RC_HTMLClear=1 Then 
				If RC_Langu=0 Then
				RC_Template_Content = Replace(RC_Template_Content, "${content}",ClearHTMLChn(rs("content")))
				Else 
				RC_Template_Content = Replace(RC_Template_Content, "${content}",ClearHTML(rs("content")))
				End If 
			Else 
				RC_Template_Content = Replace(RC_Template_Content, "${content}",rs("content"))
			End If 
		End If 
		If photofield<>"" Then
			RC_Template_Content = Replace(RC_Template_Content, "${"&photofield&"}","<a href='"&rs(photofield)&"' target='_blank'><img src='"&rs(photofield)&"' alt='"&rs(titlefield)&"'/></a>")
			RC_Template_Content = Replace(RC_Template_Content, "${"&photofield&"_nolink}","<img src='"&rs(photofield)&"' alt='"&rs(titlefield)&"'/>")
			RC_Template_Content = Replace(RC_Template_Content, "${"&photofield&"_src}",rs(photofield))
		Else
			RC_Template_Content = Replace(RC_Template_Content, "${"&photofield&"}","")
			RC_Template_Content = Replace(RC_Template_Content, "${"&photofield&"_nolink}","")
			RC_Template_Content = Replace(RC_Template_Content, "${"&photofield&"_src}","")
		End If
		If pre=RZ_PRE_PRODUCT_SHOW Then
			RC_Template_Content = Replace(RC_Template_Content, "${model}",rs("productid"))
		End If 
		If pre=RZ_PRE_JOB_SHOW Then
			RC_Template_Content = Replace(RC_Template_Content, "${place}",rs("place"))
			RC_Template_Content = Replace(RC_Template_Content, "${salary}",rs("salary"))
			RC_Template_Content = Replace(RC_Template_Content, "${number}",rs("number"))
			If Not IsNull(rs("endtime")) Then 
			RC_Template_Content = Replace(RC_Template_Content, "${endtime}",year(rs("endtime"))&"-"&month(rs("endtime"))&"-"&day(rs("endtime")))
			Else
			RC_Template_Content = Replace(RC_Template_Content, "${endtime}","")
			End If 
		End If 
		RC_Template_Content = Replace(RC_Template_Content, "${addtime}",year(rs("addtime"))&"-"&month(rs("addtime"))&"-"&day(rs("addtime")))
		RC_Template_Content = Replace(RC_Template_Content, "${fulladdtime}",rs("addtime"))
		RC_Template_Content = Replace(RC_Template_Content, "${year}",Year(rs("addtime")))
		RC_Template_Content = Replace(RC_Template_Content, "${month}",Month(rs("addtime")))
		RC_Template_Content = Replace(RC_Template_Content, "${day}",Day(rs("addtime")))
		RC_Template_Content = Replace(RC_Template_Content, "${author}",rs("author"))
		RC_Template_Content = Replace(RC_Template_Content, "${hits}",rs("hits"))
		If RC_ShowNext=1 Then
			If not rs2.eof Then
				short_path=CutPath(rs2("path"))
				static_path=Replace(short_path,",","-")
				If rs2(titlefield)<>"" Then
					Dim LinkURL2
					If S_STATIC=1 Then 
						LinkURL2=GetPath(RZ_HTML_PATH&"/"&pre&RC_Langu&"/t"&static_path&"/c"&rs2("id")&".html")
					Else 
						LinkURL2=GetPath("?"&pre&RC_Langu&"-t"&short_path&"c"&rs2("id")&".html")
					End If 
					If pre=RZ_PRE_ARTICLE_SHOW Or pre=RZ_PRE_PRODUCT_SHOW Or pre=RZ_PRE_PHOTO_SHOW Then
						If rs2("specialid")>0 Then
							If S_STATIC=1 Then
								LinkURL2=GetPath(RZ_HTML_PATH&"/"&pre&RC_Langu&"/t"&static_path&"/s"&rs2("specialid")&"c"&rs2("id")&".html")
							Else 
								LinkURL2=GetPath("?"&pre&RC_Langu&"-t"&short_path&"s"&rs2("specialid")&"c"&rs2("id")&".html")
							End If 
						End If 
					End If 
					RC_Template_Content = Replace(RC_Template_Content, "${prev_"&titlefield&"}","<a href='"&LinkURL2&"'>"&rs2(titlefield)&"</a>")
				Else
					RC_Template_Content = Replace(RC_Template_Content, "${prev_"&titlefield&"}",getstr("lang_nomore"))
				End If
			Else
				RC_Template_Content = Replace(RC_Template_Content, "${prev_"&titlefield&"}" ,getstr("lang_nomore"))
			End If
			If not rs3.eof Then
				short_path=CutPath(rs3("path"))
				static_path=Replace(short_path,",","-")
				If rs3(titlefield)<>"" Then
					Dim LinkURL3
					If S_STATIC=1 Then
						LinkURL3=GetPath(RZ_HTML_PATH&"/"&pre&RC_Langu&"/t"&static_path&"/c"&rs3("id")&".html")
					Else 
						LinkURL3=GetPath("?"&pre&RC_Langu&"-t"&short_path&"c"&rs3("id")&".html")
					End If 
					If pre=RZ_PRE_ARTICLE_SHOW Or pre=RZ_PRE_PRODUCT_SHOW Or pre=RZ_PRE_PHOTO_SHOW Then
						If rs3("specialid")>0 Then
							If S_STATIC=1 Then
								LinkURL3=GetPath(RZ_HTML_PATH&"/"&pre&RC_Langu&"/t"&static_path&"/s"&rs3("specialid")&"c"&rs3("id")&".html")
							Else 
								LinkURL3=GetPath("?"&pre&RC_Langu&"-t"&short_path&"s"&rs3("specialid")&"c"&rs3("id")&".html")
							End If 
						End If 
					End If 
					RC_Template_Content = Replace(RC_Template_Content, "${next_"&titlefield&"}","<a href='"&LinkURL3&"'>"&rs3(titlefield)&"</a>")
				Else
					RC_Template_Content = Replace(RC_Template_Content, "${next_"&titlefield&"}",getstr("lang_nomore"))
				End If
			Else
				RC_Template_Content = Replace(RC_Template_Content, "${next_"&titlefield&"}",getstr("lang_nomore"))
			End If
		End If
		result=RC_Template_Content
	Else
		response.Write("请设置内容显示模板")
	End If
End Function 

'生成评论内容
Private Function GenerateCommentContent(pre,rs,rs2,rs3,replytablename)
	If RC_Template<>"" Then
		Dim RC_Template_Content
		RC_Template_Content=RC_Template
		Dim The_Path, short_path
		short_path=CutPath(rs("path"))
		The_Path=GetPath("index.asp?"&pre&RC_Langu&"-t"&short_path&"c"&rs("id")&".html")
		RC_Template_Content = Replace(RC_Template_Content, "${url}",The_Path) 
		RC_Template_Content = Replace(RC_Template_Content, "${path}",short_path) 
		RC_Template_Content = Replace(RC_Template_Content, "${typeid}",rs("typeid"))
		RC_Template_Content = Replace(RC_Template_Content, "${id}",rs("id"))
		If RC_Title_Len>0 Then 
			RC_Template_Content = Replace(RC_Template_Content, "${title}",Left(Replace(rs("title"),"&nbsp;"," "),RC_Title_Len))
		Else 
			RC_Template_Content = Replace(RC_Template_Content, "${title}" ,rs("title"))
		End If 
		If ((pre=RZ_PRE_GUESTBOOK_SHOW And app("rz_guestbookaudit")=1) Or (pre=RZ_PRE_COMMENT_SHOW And app("rz_commentaudit")=1)) And rs("visible")=0 Then 
			RC_Template_Content = Replace(RC_Template_Content, "${content}",getstr("lang_gbawaiting"))
		Else 
			If RC_Content_Len>0 Then 
				If RC_HTMLClear=1 Then
					If RC_Langu=0 Then 
					RC_Template_Content = Replace(RC_Template_Content, "${content}",Left(ClearHTMLChn(rs("content")),RC_Content_Len))
					Else 
					RC_Template_Content = Replace(RC_Template_Content, "${content}",Left(ClearHTML(rs("content")),RC_Content_Len))
					End If 
				Else 
					RC_Template_Content = Replace(RC_Template_Content, "${content}",Left(rs("content"),RC_Content_Len))
				End If 
			Else
				If RC_HTMLClear=1 Then 
					If RC_Langu=0 Then 
					RC_Template_Content = Replace(RC_Template_Content, "${content}",ClearHTMLChn(rs("content")))
					Else 
					RC_Template_Content = Replace(RC_Template_Content, "${content}",ClearHTML(rs("content")))
					End If 
				Else 
					RC_Template_Content = Replace(RC_Template_Content, "${content}",rs("content"))
				End If 
			End If 
		End If 
		RC_Template_Content = Replace(RC_Template_Content, "${addtime}",year(rs("addtime"))&"-"&month(rs("addtime"))&"-"&day(rs("addtime")))
		RC_Template_Content = Replace(RC_Template_Content, "${fulltime}",rs("addtime"))
		RC_Template_Content = Replace(RC_Template_Content, "${author}",rs("author"))
		RC_Template_Content = Replace(RC_Template_Content, "${email}",rs("email"))
		RC_Template_Content = Replace(RC_Template_Content, "${hits}",rs("hits"))
		If pre=RZ_PRE_GUESTBOOK_SHOW Then
			RC_Template_Content = Replace(RC_Template_Content, "${company}",rs("company"))
			RC_Template_Content = Replace(RC_Template_Content, "${tel}",rs("tel"))
			RC_Template_Content = Replace(RC_Template_Content, "${fax}",rs("fax"))
		End If 
			Dim replytable
		If RC_ShowReply=1 Then 
			If RC_ReplyTemplate<>"" Then 
				Dim rs1,sql1,RC_ReplyTemplate_Content,result2
				Set rs1 = Server.CreateObject("ADODB.Recordset")
				sql1="select * from "&replytablename&" where commentid="&rs("id")
				rs1.open sql1,conn,1,1
				If Not rs1.eof Then 
					Do While Not rs1.eof 
					RC_ReplyTemplate_Content=RC_ReplyTemplate
					RC_ReplyTemplate_Content = Replace(RC_ReplyTemplate_Content, "${replycontent}",rs1("content"))
					RC_ReplyTemplate_Content = Replace(RC_ReplyTemplate_Content, "${replytime}",rs1("replytime"))
					RC_ReplyTemplate_Content = Replace(RC_ReplyTemplate_Content, "${replyauthor}",rs1("replyauthor"))
					result2=result2&RC_ReplyTemplate_Content
					rs1.movenext
					Loop
					RC_Template_Content = Replace(RC_Template_Content, RC_ReplyTemplate0,result2)
				Else
					RC_Template_Content = Replace(RC_Template_Content, RC_ReplyTemplate0,"")
				End If 
				rs1.close
				Set rs1=Nothing
			End If 
		End If 
		If pre=RZ_PRE_COMMENT_SHOW Then
			Dim rs0,sql0,recordtable,recordtitle,recordpre
			Select Case rs("fenlei")
				Case 1:
					recordtable="c_article"
					recordtitle="title"
					recordpre=RZ_PRE_ARTICLE_SHOW
				Case 2:
					recordtable="c_product"
					recordtitle="productname"
					recordpre=RZ_PRE_PRODUCT_SHOW
				Case 3:
					recordtable="c_photo"
					recordtitle="photoname"
					recordpre=RZ_PRE_PHOTO_SHOW
			End Select 
			Set rs0=Server.CreateObject("ADODB.RecordSet")
			sql0="select * from "&recordtable&" where id="&rs("recordid")
			rs0.open sql0,conn,1,1
			If Not rs0.eof Then
				Dim record_static_path,record_short_path
				record_short_path=CutPath(rs0("path"))
				record_static_path=Replace(record_short_path,",","-")
				LinkURL3=GetPath("index.asp?"&recordpre&RC_Langu&"-t"&record_short_path&"c"&rs0("id")&".html")
				RC_Template_Content = Replace(RC_Template_Content, "${recordtitle}","<a href='"&LinkURL3&"'>"&rs0(recordtitle)&"</a>")
				RC_Template_Content = Replace(RC_Template_Content, "${recordurl}",LinkURL3)
				RC_Template_Content = Replace(RC_Template_Content, "${recordtitle_nolink}",rs0(recordtitle))
				RC_Template_Content = Replace(RC_Template_Content, "${recordcontent}",rs0("content"))
				If recordtable="c_product" Then 
				RC_Template_Content = Replace(RC_Template_Content, "${recordimage}",rs0("productimg"))
				End If 
				If recordtable="c_photo" Then 
				RC_Template_Content = Replace(RC_Template_Content, "${recordimage}",rs0("photoimg"))
				End If 
			Else
				RC_Template_Content = Replace(RC_Template_Content, "${recordimage}","")
				RC_Template_Content = Replace(RC_Template_Content, "${recordcontent}","")
				RC_Template_Content = Replace(RC_Template_Content, "${recordtitle_nolink}","")
				RC_Template_Content = Replace(RC_Template_Content, "${recordurl}","")
				RC_Template_Content = Replace(RC_Template_Content, "${recordtitle}","")
			End If 
			rs0.close
			Set rs0=Nothing 
		End If 
		If RC_ShowNext=1 Then
			If not rs2.eof Then
				short_path=CutPath(rs2("path"))
				If rs2("title")<>"" Then
					Dim LinkURL2
					LinkURL2=GetPath("index.asp?"&pre&RC_Langu&"-t"&short_path&"c"&rs2("id")&".html")
					RC_Template_Content = Replace(RC_Template_Content, "${prev_title}","<a href='"&LinkURL2&"'>"&rs2("title")&"</a>")
				Else
					RC_Template_Content = Replace(RC_Template_Content, "${prev_title}",getstr("lang_nomore"))
				End If
			Else
				RC_Template_Content = Replace(RC_Template_Content, "${prev_title}" ,getstr("lang_nomore"))
			End If
			If not rs3.eof Then
				short_path=CutPath(rs3("path"))
				If rs3("title")<>"" Then
					Dim LinkURL3
					LinkURL3=GetPath("index.asp?"&pre&RC_Langu&"-t"&short_path&"c"&rs3("id")&".html") 
					RC_Template_Content = Replace(RC_Template_Content, "${next_title}","<a href='"&LinkURL3&"'>"&rs3("title")&"</a>")
				Else
					RC_Template_Content = Replace(RC_Template_Content, "${next_title}",getstr("lang_nomore"))
				End If
			Else
				RC_Template_Content = Replace(RC_Template_Content, "${next_title}",getstr("lang_nomore"))
			End If
		End If
		result=RC_Template_Content
	Else
		response.Write("请设置内容显示模板")
	End If
End Function 


End Class

'广告显示类
Class RZAdvertise
Private RA_Template, RA_Id, RA_Type, RA_Random, RA_Num, RA_PhotoWidth, RA_PhotoHeight, RA_Separator, RA_SeriesSRC, RA_SeriesALT,RA_SeriesHREF,RA_SeriesDesc, RA_Series,RA_Ids, gen,result

'设置模板
Public Property Let Template(s_Template)
	RA_Template=ReadTagFile(s_Template)
End Property

'设置记录的ID
Public Property Let Id(i_Id)
	if isNumber(i_Id) Then
		RA_Id=CInt(i_Id)
	End If
End Property

'设置记录的ID（多条）
Public Property Let Ids(s_Ids)
	if isNumber(s_Ids) Then
		RA_Id=s_Ids
	Else
		Dim i,v
		For i=1 To Len(Trim(s_Ids))
			v=Mid(s_Ids,i,1)
			If Instr("0123456789,",v)<=0 Then
				WriteError("id之间用逗号分隔，例子：12,28")
			End If
		Next
		RA_Ids=s_Ids
	End If
End Property

'ADType 广告类型，1为文本，2为图片，3为flash，4为代码
Public Property Let ADType(i_Type)
	If i_Type="1" Or i_Type="2" Or i_Type="3" Or i_Type="4" Then 
		RA_Type=i_Type
	Else 
		WriteError("类型参数错误")
	End If 
End Property

'是否随机显示，1为是
Public Property Let Random(i_Random)
	If i_Random="0" Or i_Random="1" Then 
		RA_Random=i_Random
	Else
		WriteError("Random只能为1或0")
	End If 
End Property

'广告数量
Public Property Let Num(i_Num)
	If isNumber(i_Num) Then
		RA_Num=CInt(i_Num)
	Else
		WriteError("广告数量参数错误")
	End If
End Property

'设置图片宽度，0表示不指定宽度
Public Property Let PhotoWidth(i_PhotoWidth)
	if isNumber(i_PhotoWidth) Then
		RA_PhotoWidth=CInt(i_PhotoWidth)
	End If
End Property

'设置图片高度，0表示不指定高度
Public Property Let PhotoHeight(i_PhotoHeight)
	if isNumber(i_PhotoHeight) Then
		RA_PhotoHeight=CInt(i_PhotoHeight)
	End If
End Property

'设置连串输出分隔符
Public Property Let Separator(c_Separator)
	RA_Separator=c_Separator
End Property

'是否连串输出
Public Property Let Series(i_Series)
	If i_Series="0" Or i_Series="1" Then 
		RA_Series=i_Series
	End If 
End Property

'初始化
Private Sub Class_Initialize
	RA_Id=0
	RA_Type=1
	RA_Num=0
	RA_Series=0
	RA_Random=0
	RA_PhotoWidth=0
	RA_PhotoHeight=0
	result=""
	RA_SeriesSRC=""
	RA_SeriesHREF=""
	RA_SeriesALT=""
	RA_SeriesDesc=""
	RA_Separator="|"
	gen=0
End Sub

'销毁
Private Sub Class_Terminate 
End Sub

'输出结果
Public Sub Show()
	If gen=0 Then Generate()
	response.write(result)
End Sub 

'生成
Public Sub Generate()
	Dim sql,rs,tmp_content
	If RA_Id>0 then
		sql="select * from c_advertise where id="&RA_Id
		RA_Random=0
		RA_Num=1
	Else
		Dim sqltop,sqltype,sqlsize1,sqlsize2,sqlids
		If RA_Num>0 Then 
		sqltop=" top "&RA_Num
		End If 
		If RA_Type>0 Then
			sqltype=" and ad_type="&RA_Type&" "
		End If 
		If RA_PhotoWidth>0 And (RA_Type=2 Or RA_Type=3) Then
			sqlsize1=" and ad_imgswf_width="&RA_PhotoWidth&" "
		End If 
		If RA_PhotoHeight>0 And (RA_Type=2 Or RA_Type=3) Then
			sqlsize2=" and ad_imgswf_height="&RA_PhotoHeight&" "
		End If 
		If RA_Ids<>"" Then 
			sqlids=" and id in ("&RA_Ids&") "
		End If 
		Dim nowtime
		nowtime=DateValue(Now())
		If RA_Random=0 Then 
			sql="select "&sqltop&" * from c_advertise where ad_begintime<=#"&nowtime&"# and ad_endtime>=#"&nowtime&"#"&sqltype&sqlsize1&sqlsize2&sqlids
		Else
			sql="select * from c_advertise where ad_begintime<=#"&nowtime&"# and ad_endtime>=#"&nowtime&"#"&sqltype&sqlsize1&sqlsize2&sqlids
		End If 
		sql=sql&" order by id desc"
	End If
	Dim pointer
	set rs=server.createobject("adodb.recordset")
	rs.open sql,conn,1,1
	Dim rcount
	rcount=rs.recordcount
	If rcount>0 Then
	If RA_Num=0 Then RA_Num=rcount
		If RA_Random=0 Then 
			pointer=1
			Do While Not rs.eof
				If RA_Series="1" And RA_Separator<>""  Then 
					RA_SeriesSRC=RA_SeriesSRC&rs("ad_imgswf")&RA_Separator
					RA_SeriesALT=RA_SeriesALT&rs("ad_alt")&RA_Separator
					RA_SeriesHREF=RA_SeriesHREF&rs("ad_link")&RA_Separator
					RA_SeriesDesc=RA_SeriesDesc&rs("ad_description")&RA_Separator
				Else
					If RA_Template<>"" Then
						tmp_content=RA_Template
						tmp_content = Replace(tmp_content, "${src}",rs("ad_imgswf"))
						tmp_content = Replace(tmp_content, "${alt}",rs("ad_alt"))
						tmp_content = Replace(tmp_content, "${href}",rs("ad_link"))
						tmp_content = Replace(tmp_content, "${code}",rs("ad_code"))
						tmp_content = Replace(tmp_content, "${desc}",rs("ad_description"))
						tmp_content = Replace(tmp_content, "${i}",pointer)
						result=result&tmp_content
					Else
						result=result&rs("ad_code")
					End If
				End If 
				pointer=pointer+1
			rs.movenext
			Loop
		Else
			If rcount>RA_Num Then 
				ReDim rs_arr(RA_Num,5)
				ReDim i_arr(rcount)
			Else
				ReDim rs_arr(rcount,5)
				ReDim i_arr(rcount)
				RA_Num=rcount
			End If 
			Dim i,j,k
			For Each i In i_arr
				 i=0
			Next
			Randomize
			for i=1 to RA_Num
				 j=int(rnd*rcount+1)
				 do while i_arr(j)<>0
				   j=int(rnd*rcount+1)
				 loop
				 i_arr(j)=1
			Next
			j=1
			k=1
			Do While Not rs.eof
				if i_arr(j)=1 then
					rs_arr(k,1)=rs("ad_imgswf") 
					rs_arr(k,2)=rs("ad_alt") 
					rs_arr(k,3)=rs("ad_link") 
					rs_arr(k,4)=rs("ad_code")
					rs_arr(k,5)=rs("ad_description") 
					k=k+1
				end if
			j=j+1
			rs.MoveNext
			Loop
			for k=1 to RA_Num
				If RA_Series="1" And RA_Separator<>""  Then 
					RA_SeriesSRC=RA_SeriesSRC&rs_arr(k,1)&RA_Separator
					RA_SeriesALT=RA_SeriesALT&rs_arr(k,2)&RA_Separator
					RA_SeriesHREF=RA_SeriesHREF&rs_arr(k,3)&RA_Separator
					RA_SeriesDesc=RA_SeriesDesc&rs_arr(k,5)&RA_Separator
				Else 
					If RA_Template<>"" Then
						tmp_content=RA_Template
						tmp_content = Replace(tmp_content, "${src}",rs_arr(k,1))
						tmp_content = Replace(tmp_content, "${alt}",rs_arr(k,2))
						tmp_content = Replace(tmp_content, "${href}",rs_arr(k,3))
						tmp_content = Replace(tmp_content, "${code}",rs_arr(k,4))
						tmp_content = Replace(tmp_content, "${desc}",rs_arr(k,5))
						tmp_content = Replace(tmp_content, "${i}",k)
						result=result&tmp_content
					Else
						result=result&rs_arr(k,4)
					End If
				End If 
			next
		End If 
		If RA_Series="1" And RA_Separator<>"" Then
			tmp_content=RA_Template
			If RA_SeriesSRC<>"" Then 
				RA_SeriesSRC=Left(RA_SeriesSRC,(Len(RA_SeriesSRC)-1))
			End If 
			If RA_SeriesALT<>"" Then 
				RA_SeriesALT=Left(RA_SeriesALT,(Len(RA_SeriesALT)-1))
			End If
			If RA_SeriesHREF<>"" Then 
				RA_SeriesHREF=Left(RA_SeriesHREF,(Len(RA_SeriesHREF)-1))
			End If 
			If RA_SeriesDesc<>"" Then 
				RA_SeriesDesc=Left(RA_SeriesDesc,(Len(RA_SeriesDesc)-1))
			End If 
			tmp_content = Replace(tmp_content, "${s_src}",RA_SeriesSRC)
			tmp_content = Replace(tmp_content, "${s_alt}",RA_SeriesALT)
			tmp_content = Replace(tmp_content, "${s_href}",RA_SeriesHREF)
			tmp_content = Replace(tmp_content, "${s_desc}",RA_SeriesDesc)
			result=tmp_content
		End If 
	Else
		tmp_content=RA_Template
		tmp_content = Replace(tmp_content, "${src}","")
		tmp_content = Replace(tmp_content, "${alt}","")
		tmp_content = Replace(tmp_content, "${href}","")
		tmp_content = Replace(tmp_content, "${code}","")
		tmp_content = Replace(tmp_content, "${s_src}","")
		tmp_content = Replace(tmp_content, "${s_alt}","")
		tmp_content = Replace(tmp_content, "${s_href}","")
		tmp_content = Replace(tmp_content, "${s_desc}","")
		result=tmp_content
	End If 
	rs.close
	set rs=Nothing
	gen=1
End Sub

'返回连续的SRC信息，默认以|分隔
Public Property Get SeriesSRC()
	If gen=0 Then Generate()
	SeriesSRC=RA_SeriesSRC
End Property

'返回连续的HREF信息，默认以|分隔
Public Property Get SeriesHREF()
	If gen=0 Then Generate()
	SeriesHREF=RA_SeriesHREF
End Property

'返回连续的ALT信息，默认以|分隔
Public Property Get SeriesALT()
	If gen=0 Then Generate()
	SeriesALT=RA_SeriesALT
End Property

'返回连续的Desc信息，默认以|分隔
Public Property Get SeriesDesc()
	If gen=0 Then Generate()
	SeriesDesc=RA_SeriesDesc
End Property

'返回结果
Public Property Get GetResult()
	If gen=0 Then Generate()
	GetResult=result
End Property
End Class

'友情链接显示类
Class RZFriendLink
Private RF_Template, RF_Id,RF_Ids, RF_Random, RF_Num,RF_Title_Len, gen,result

'设置模板
Public Property Let Template(s_Template)
	RF_Template=ReadTagFile(s_Template)
End Property

'设置记录的ID
Public Property Let Id(i_Id)
	if isNumber(i_Id) Then
		RF_Id=CInt(i_Id)
	End If
End Property

'设置记录的ID（多条）
Public Property Let Ids(s_Ids)
	if isNumber(s_Ids) Then
		RF_Id=s_Ids
	Else
		Dim i,v
		For i=1 To Len(Trim(s_Ids))
			v=Mid(s_Ids,i,1)
			If Instr("0123456789,",v)<=0 Then
				WriteError("id之间用逗号分隔，例子：12,28")
			End If
		Next
		RF_Ids=s_Ids
	End If
End Property

'是否随机显示，1为是
Public Property Let Random(i_Random)
	If i_Random="0" Or i_Random="1" Then 
		RF_Random=i_Random
	Else
		WriteError("Random只能为1或0")
	End If 
End Property

'数量，0为全部显示
Public Property Let Num(i_Num)
	If isNumber(i_Num) Then
		RF_Num=CInt(i_Num)
	Else
		WriteError("数量参数错误")
	End If
End Property

'设置标题长度，0表示全部显示
Public Property Let TitleLength(i_TitleLength)
	if isNumber(i_TitleLength) Then
		RF_Title_Len=CInt(i_TitleLength)
	End If
End Property


'初始化
Private Sub Class_Initialize
	RF_Id=0
	RF_Num=1
	RF_Random=0
	RF_Ids=""
	result=""
	gen=0
End Sub

'销毁
Private Sub Class_Terminate 
End Sub

'输出结果
Public Sub Show()
	If gen=0 Then Generate()
	response.write(result)
End Sub 

'生成
Public Sub Generate()
	Dim sql,rs,tmp_content
	If RF_Id>0 then
		sql="select * from c_friendlink where id="&RF_Id
		RF_Random=0
		RF_Num=1
	Else
		Dim sqltop,sqltype,sqlsize,sqlids
		If RF_Num>0 Then 
		sqltop=" top "&RF_Num
		End If 
		Dim nowtime
		nowtime=DateValue(Now())
		If RF_Ids<>"" Then 
			sqlids=" where id in ("&RF_Ids&") "
		End If 
		If RF_Random=0 Then 
			sql="select "&sqltop&" * from c_friendlink "&sqlids&" order by theorder,id desc"
		Else
			sql="select * from c_friendlink "&sqlids&" order by theorder, id desc"
		End If 
	End If
	Dim pointer
	set rs=server.createobject("adodb.recordset")
	rs.open sql,conn,1,1
	Dim rcount
	rcount=rs.recordcount
	If rcount>0 then
		If RF_Random=0 Then 
			pointer=1
			Do While Not rs.eof
				If RF_Template<>"" Then
					tmp_content=RF_Template
					If RF_Title_Len>0 Then 
					tmp_content = Replace(tmp_content, "${name}",Left(rs("name"),RF_Title_Len))
					Else 
					tmp_content = Replace(tmp_content, "${name}",rs("name"))
					End If 
					tmp_content = Replace(tmp_content, "${url}",rs("url"))
					tmp_content = Replace(tmp_content, "${logo}","<a href="""&rs("url")&""" title="""&rs("name")&"""><img src="""&rs("logo")&"""/></a>")
					tmp_content = Replace(tmp_content, "${logo_src}",rs("logo"))
					tmp_content = Replace(tmp_content, "${description}",rs("description"))
					tmp_content = Replace(tmp_content, "${i}",pointer)
					result=result&tmp_content
				Else
					result=result&"<a href='"&rs("url")&"' target='_blank'>"&rs("name")&"</a>"
				End If
				pointer=pointer+1
			rs.movenext
			Loop
		Else
			If rcount>RF_Num Then 
				ReDim rs_arr(RF_Num,4)
				ReDim i_arr(rcount)
			Else
				ReDim rs_arr(rcount,4)
				ReDim i_arr(rcount)
				RF_Num=rcount
			End If 
			Dim i,j,k
			For Each i In i_arr
				 i=0
			Next
			Randomize
			for i=1 to RF_Num
				 j=int(rnd*rcount+1)
				 do while i_arr(j)<>0 
				   j=int(rnd*rcount+1)
				 loop
				 i_arr(j)=1
			Next
			j=1
			k=1
			Do While Not rs.eof
				if i_arr(j)=1 then
					rs_arr(k,1)=rs("name") 
					rs_arr(k,2)=rs("url")
					rs_arr(k,3)=rs("logo") 
					rs_arr(k,4)=rs("description") 
					k=k+1
				end if
			j=j+1
			rs.MoveNext
			Loop
			for k=1 to RF_Num
				If RF_Template<>"" Then
					tmp_content=RF_Template
					tmp_content = Replace(tmp_content, "${name}",rs_arr(k,1))
					tmp_content = Replace(tmp_content, "${url}",rs_arr(k,2))
					tmp_content = Replace(tmp_content, "${logo_img}",rs_arr(k,3))
					tmp_content = Replace(tmp_content, "${logo}","<a href="""&rs_arr(k,2)&""" title="""&rs_arr(k,1)&"""><img src="""&rs_arr(k,3)&"""/></a>")
					tmp_content = Replace(tmp_content, "${description}",rs_arr(k,4))
					tmp_content = Replace(tmp_content, "${i}",k)
					result=result&tmp_content
				Else
					result=result&rs_arr(k,4)
				End If
			next
		End If 
	Else
		tmp_content=RF_Template
		tmp_content = Replace(tmp_content, "${name}","")
		tmp_content = Replace(tmp_content, "${url}","")
		tmp_content = Replace(tmp_content, "${logo}","")
		tmp_content = Replace(tmp_content, "${description}","")
		result=tmp_content
	End If 
	rs.close
	set rs=Nothing
	gen=1
End Sub

'返回结果
Public Property Get GetResult()
	If gen=0 Then Generate()
	GetResult=result
End Property
End Class

'分类或专题显示类
Class RZST
Private RT_Template, RT_Id, RT_Type, RT_Num, RT_RZParam, RT_Langu, RZ_Name, RT_Title_Len,RT_Content_Len, RT_HtmlClear,RT_HaveContent,RT_IfContent,RT_IfImage, gen, result

'设置语言
Public Property Let Langu(i_Langu)
	If i_Langu="0" Or i_Langu="1" Then 
		RT_Langu=CInt(i_Langu)
	Else
		WriteError("Langu参数不正确")
	End If
End Property

'只有内容不为空才显示
Public Property Let IfContent(i_IfContent)
	If i_IfContent="0" Or i_IfContent="1" Then 
		RT_IfContent=CInt(i_IfContent)
	Else
		WriteError("IfContent参数不正确")
	End If
End Property

'只有图片不为空才显示
Public Property Let IfImage(i_IfImage)
	If i_IfImage="0" Or i_IfImage="1" Then 
		RT_IfImage=CInt(i_IfImage)
	Else
		WriteError("IfImage参数不正确")
	End If
End Property

'设置模板
Public Property Let Template(s_Template)
	RT_Template=ReadTagFile(s_Template)
	If InStr(RT_Template,"${content}")=0 Then RT_HaveContent=0
End Property

'设置RZParam对象
Public Property Let ObjRZParam(o_Param)
	If IsObject(o_Param) Then 
		Set RT_RZParam=o_Param
	End If 
End Property

'设置记录的ID
Public Property Let Id(i_Id)
	if isNumber(i_Id) Then
		RT_Id=CInt(i_Id)
	End If
End Property

'分类还是专题 
Public Property Let TypeSpecial(s_Type)
	If s_Type="special" Or s_Type="type" then
		RT_Type=s_Type
	Else
		WriteError("类型设置不正确")
	End If 
End Property

'设置内容显示长度
Public Property Let ContentLength(i_ContentLength)
	if isNumber(i_ContentLength) Then
		RT_Content_Len=CInt(i_ContentLength)
	End If
End Property

'设置标题长度
Public Property Let TitleLength(i_TitleLength)
	if isNumber(i_TitleLength) Then
		RT_Title_Len=CInt(i_TitleLength)
	End If
End Property

'是否清除内容的HTML标记
Public Property Let HTMLClear(i_HTMLClear)
	If i_HTMLClear="0" Or i_HTMLClear="1" Then 
		RT_HTMLClear=CInt(i_HTMLClear)
	Else
		WriteError("RC_ClearHTML参数不正确")
	End If
End Property

'初始化
Private Sub Class_Initialize
	RT_Id=0
	RT_Num=1
	RT_Langu=S_LANG
	RT_Title_Len=0
	RT_HaveContent=1
	RT_Content_Len=0
	RT_HTMLClear=0
	RT_IfImage=0
	RT_IfContent=0
	If RT_Langu="" Then RT_Langu=0
	gen=0
	If S_RZParam.Process=RZ_PRE_SPECIAL_SHOW Then
		RT_Type="special"
		RT_Id=S_RZParam.Specialid
	ElseIf S_RZParam.Process=RZ_PRE_TYPE_SHOW Or S_RZParam.Process=RZ_PRE_ARTICLE_LIST Or S_RZParam.Process=RZ_PRE_PRODUCT_LIST Or S_RZParam.Process=RZ_PRE_PHOTO_LIST Then 
		RT_Type="type"
		RT_Id=S_RZParam.Typeid
	End If 
End Sub

'销毁
Private Sub Class_Terminate 
End Sub

'显示内容
Public Sub Show()
	If gen=0 Then Generate()
	response.write(result)
End Sub 

'返回分类或专题的名称
Public Property Get GetName()
	If gen=0 Then Generate()
	GetName=RZ_Name
End Property

'返回结果
Public Property Get GetResult()
	If gen=0 Then Generate()
	GetResult=result
End Property

'生成
Public Sub Generate()
	Dim sql,rs,tmp_content
	If RT_Id>0 Then
		If RT_Type="special" Then 
			sql="select * from c_special where visible=1 and id="&RT_Id
		Else
			sql="select * from c_type where visible=1 and id="&RT_Id
		End If 
		
		set rs=server.createobject("adodb.recordset")
		rs.open sql,conn,1,1
		Do While  Not rs.eof
		Dim content,name,img
		If RT_Langu=1  Then 
			If RT_HaveContent=1 then
			content=rs("content_eng")
			End if
			If RT_Type="type" Then 
				name=Replace(rs("engname"),"&nbsp;"," ")
				img=rs("typeimg")
			Else
				name=Replace(rs("specialengname"),"&nbsp;"," ")
				img=rs("specialimg")
			End If 
		ElseIf RT_Langu=0 Then 
			If RT_HaveContent=1 Then 
			content=rs("content_chn")
			End If 
			If RT_Type="type" Then 
				name=Replace(rs("name"),"&nbsp;"," ")
				img=rs("typeimg")
			Else
				name=Replace(rs("specialname"),"&nbsp;"," ")
				img=rs("specialimg")
			End If 
		Else
			content=""
			name=""
		End If 
		If RT_IfContent=1 And (IsNull(content) Or content="") Then 
			result="" 
			Exit Sub 
		End If 	
		If RT_IfImage=1 And (IsNull(img) Or img="") Then 
			result="" 
			Exit Sub 
		End If 		
		RZ_Name=name
		tmp_content=RT_Template

			If RT_Template<>"" Then
				tmp_content = Replace(tmp_content, "${id}",rs("id"))
				If RT_Content_Len>0 Then
					If content<>"" Then 
						If RT_HTMLClear=1 Then
							If RT_Langu=0 Then 
							tmp_content = Replace(tmp_content, "${content}",Left(ClearHtmlChn(content),RT_Content_Len))
							Else 
							tmp_content = Replace(tmp_content, "${content}",Left(ClearHtml(content),RT_Content_Len))
							End If 
						Else 
							tmp_content = Replace(tmp_content, "${content}",Left(content,RT_Content_Len))
						End If 
					Else
						tmp_content = Replace(tmp_content, "${content}","")
					End If 
				Else
					If content<>"" Then 
						If RT_HtmlClear=1 Then 
							If RT_Langu=0 Then 
							tmp_content = Replace(tmp_content, "${content}",ClearHtmlChn(content))
							Else 
							tmp_content = Replace(tmp_content, "${content}",ClearHtml(content))
							End If 
						Else 
							tmp_content = Replace(tmp_content, "${content}",content)
						End If 
					Else
						tmp_content = Replace(tmp_content, "${content}","")
					End If
				End If 
				If RT_Title_Len>0 Then 
					tmp_content = Replace(tmp_content, "${name}",Left(name,RT_Title_Len))
				Else 
					tmp_content = Replace(tmp_content, "${name}",name)
				End If 
				If img<>"" Then 
				tmp_content = Replace(tmp_content, "${img}","<img src='"&img&"' alt='"&name&"'/>")
				tmp_content = Replace(tmp_content, "${img_src}",img)
				Else
				tmp_content = Replace(tmp_content, "${img}","")
				tmp_content = Replace(tmp_content, "${img_src}","")
				End If 
				Dim LinkURL
				If RT_Type="type" Then 
					Dim short_path,static_path,pre,url_nonstatic,type_pre
					short_path=CutPath(rs("path"))
					static_path=Replace(short_path,",","-")
					Select Case rs("fenlei")
						Case 1:
							type_pre=RZ_PRE_ARTICLE_LIST
						Case 2:
							type_pre=RZ_PRE_PRODUCT_LIST
						Case 3:
							type_pre=RZ_PRE_PHOTO_LIST
						Case 5:
							type_pre=RZ_PRE_GUESTBOOK_LIST
						Case 6:
							type_pre=RZ_PRE_TYPE_SHOW
						Case 7:
							type_pre=RZ_PRE_JOB_LIST
					End Select 
					If type_pre<>"" Then 
						If S_STATIC=1 Then
							LinkURL=GetPath(RZ_HTML_PATH&"/"&type_pre&RT_Langu&"/t"&static_path&".html")
						Else 
							LinkURL=GetPath("?"&type_pre&RT_Langu&"-t"&short_path&".html")
						End If
						url_nonstatic=GetPath("index.asp?"&type_pre&RT_Langu&"-t"&short_path&".html")
					Else
						LinkURL=GetPath(rs("url"))
						url_nonstatic=LinkURL
					End If 
				Else 
					If S_STATIC=1 Then
					LinkURL=GetPath(RZ_HTML_PATH&"/"&RZ_PRE_SPECIAL_SHOW&RT_Langu&"/s"&rs("id")&".html")
					Else 
						LinkURL=GetPath("?"&RZ_PRE_SPECIAL_SHOW&RT_Langu&"-s"&rs("id")&".html")
					End If 
					url_nonstatic=GetPath("index.asp?"&RZ_PRE_SPECIAL_SHOW&RT_Langu&"-s"&rs("id")&".html")
				End If 
				tmp_content = Replace(tmp_content, "${url}",LinkURL)
				tmp_content = Replace(tmp_content, "${url_nonstatic}",url_nonstatic)
				result=tmp_content
			Else
				result=content
			End if
		rs.movenext
		Loop 
		rs.close
		Set rs=Nothing 
	End If
End Sub
End Class
%>